// TODO: release
// TODO: something in plexus to show all active hooks?
ArtifactRepositoryLayout repositoryLayout =
(ArtifactRepositoryLayout) embedder.lookup( ArtifactRepositoryLayout.ROLE, "default" );
ArtifactRepositoryFactory artifactRepositoryFactory =
(ArtifactRepositoryFactory) embedder.lookup( ArtifactRepositoryFactory.ROLE );
String url = settings.getLocalRepository();
if ( !url.startsWith( "file:" ) )
{
url = "file://" + url;
}
ArtifactRepository localRepository = new DefaultArtifactRepository( "local", url, repositoryLayout );
boolean snapshotPolicySet = false;
if ( commandLine.hasOption( CLIManager.OFFLINE ) )
{
settings.setOffline( true );
snapshotPolicySet = true;
}
if ( !snapshotPolicySet && commandLine.hasOption( CLIManager.UPDATE_SNAPSHOTS ) )
{
artifactRepositoryFactory.setGlobalUpdatePolicy( ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS );
}
if ( commandLine.hasOption( CLIManager.CHECKSUM_FAILURE_POLICY ) )
{
System.out.println( "+ Enabling strict checksum verification on all artifact downloads." );
artifactRepositoryFactory.setGlobalChecksumPolicy( ArtifactRepositoryPolicy.CHECKSUM_POLICY_FAIL );
}
else if ( commandLine.hasOption( CLIManager.CHECKSUM_WARNING_POLICY ) )
{
System.out.println( "+ Disabling strict checksum verification on all artifact downloads." );
artifactRepositoryFactory.setGlobalChecksumPolicy( ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN );
}
return localRepository;
}