}
private void install( RepositorySystemSession session, RequestTrace trace, Artifact artifact )
throws InstallationException
{
LocalRepositoryManager lrm = session.getLocalRepositoryManager();
File srcFile = artifact.getFile();
File dstFile = new File( lrm.getRepository().getBasedir(), lrm.getPathForLocalArtifact( artifact ) );
artifactInstalling( session, trace, artifact, dstFile );
Exception exception = null;
try
{
boolean copy =
"pom".equals( artifact.getExtension() ) || srcFile.lastModified() != dstFile.lastModified()
|| srcFile.length() != dstFile.length();
if ( copy )
{
fileProcessor.copy( srcFile, dstFile, null );
dstFile.setLastModified( srcFile.lastModified() );
}
else
{
logger.debug( "Skipped re-installing " + srcFile + " to " + dstFile + ", seems unchanged" );
}
lrm.add( session, new LocalArtifactRegistration( artifact ) );
}
catch ( Exception e )
{
exception = e;
throw new InstallationException( "Failed to install artifact " + artifact + ": " + e.getMessage(), e );