org.apache.maven.artifact.repository.ArtifactRepositoryFactory Java Examples
The following examples show how to use
org.apache.maven.artifact.repository.ArtifactRepositoryFactory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractJnlpMojoTest.java From webstart with MIT License | 6 votes |
private void setUpProject( File pomFile, AbstractMojo mojo ) throws Exception { MavenProjectBuilder projectBuilder = (MavenProjectBuilder) lookup( MavenProjectBuilder.ROLE ); ArtifactRepositoryFactory artifactRepositoryFactory = (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE ); ArtifactRepositoryPolicy policy = new ArtifactRepositoryPolicy( true, "never", "never" ); String localRepoUrl = "file://" + System.getProperty( "user.home" ) + "/.m2/repository"; ArtifactRepository localRepository = artifactRepositoryFactory.createArtifactRepository( "local", localRepoUrl, new DefaultRepositoryLayout(), policy, policy ); ProfileManager profileManager = new DefaultProfileManager( getContainer() ); MavenProject project = projectBuilder.buildWithDependencies( pomFile, localRepository, profileManager ); //this gets the classes for these tests of this mojo (exec plugin) onto the project classpath for the test project.getBuild().setOutputDirectory( new File( "target/test-classes" ).getAbsolutePath() ); setVariableValueToObject( mojo, "project", project ); }
Example #2
Source File: DefaultArtifactDownloader.java From opoopress with Apache License 2.0 | 6 votes |
public DefaultArtifactDownloader(Log log, ArtifactFactory artifactFactory, ArtifactResolver artifactResolver, ArtifactRepository localRepository, List<ArtifactRepository> remoteArtifactRepositories, String remoteRepositories, Map<String, ArtifactRepositoryLayout> repositoryLayouts, ArtifactRepositoryFactory artifactRepositoryFactory, ArtifactMetadataSource artifactMetadataSource, boolean enableOpooPressRepos) { this.artifactFactory = artifactFactory; this.artifactResolver = artifactResolver; this.localRepository = localRepository; this.remoteArtifactRepositories = remoteArtifactRepositories; this.remoteRepositories = remoteRepositories; this.repositoryLayouts = repositoryLayouts; this.artifactRepositoryFactory = artifactRepositoryFactory; this.artifactMetadataSource = artifactMetadataSource; this.enableOpooPressRepos = enableOpooPressRepos; this.log = log; }
Example #3
Source File: NexusTestBase.java From netbeans with Apache License 2.0 | 5 votes |
@Override protected void setUp() throws Exception { clearWorkDir(); PlacesTestUtils.setUserDirectory(getWorkDir()); File repo = new File(getWorkDir(), "repo"); embedder = EmbedderFactory.getProjectEmbedder(); System.setProperty("no.local.settings", "true"); defaultArtifactRepository = embedder.lookupComponent(ArtifactRepositoryFactory.class).createArtifactRepository("test", Utilities.toURI(repo).toString(), "default", null, null); embedder.setUpLegacySupport(); // XXX could use org.sonatype.aether.RepositorySystem to avoid maven-compat artifactInstaller = embedder.lookupComponent(ArtifactInstaller.class); info = new RepositoryInfo("test", "Test", repo.getAbsolutePath(), null); RepositoryPreferences.getInstance().addOrModifyRepositoryInfo(info); nrii = Lookup.getDefault().lookup(NexusRepositoryIndexerImpl.class); }
Example #4
Source File: AbstractDaemonGeneratorTest.java From appassembler with MIT License | 2 votes |
public void runTest( String generatorId, String pom, String descriptor, String outputPath ) throws Exception { File outputDir = getTestFile( outputPath ); DaemonGenerator generator = (DaemonGenerator) lookup( DaemonGenerator.ROLE, generatorId ); // ----------------------------------------------------------------------- // Build the MavenProject instance // ----------------------------------------------------------------------- MavenProjectBuilder projectBuilder = (MavenProjectBuilder) lookup( MavenProjectBuilder.ROLE ); MavenSettingsBuilder settingsBuilder = (MavenSettingsBuilder) lookup( MavenSettingsBuilder.ROLE ); Settings settings = settingsBuilder.buildSettings(); ArtifactRepositoryFactory artifactRepositoryFactory = (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE ); String localRepoUrl = new File( settings.getLocalRepository() ).toURL().toExternalForm(); ArtifactRepository localRepository = artifactRepositoryFactory.createDeploymentArtifactRepository( "local", localRepoUrl, new DefaultRepositoryLayout(), false ); ProfileManager profileManager = new DefaultProfileManager( getContainer() ); File tempPom = createFilteredFile( pom ); MavenProject project = projectBuilder.buildWithDependencies( tempPom, localRepository, profileManager ); // ----------------------------------------------------------------------- // Clean the output directory // ----------------------------------------------------------------------- FileUtils.deleteDirectory( outputDir ); FileUtils.forceMkdir( outputDir ); // ----------------------------------------------------------------------- // // ----------------------------------------------------------------------- DaemonGeneratorService daemonGeneratorService = (DaemonGeneratorService) lookup( DaemonGeneratorService.ROLE ); Daemon model = daemonGeneratorService.loadModel( getTestFile( descriptor ) ); generator.generate( new DaemonGenerationRequest( model, project, localRepository, outputDir, "bin" ) ); }