org.eclipse.aether.internal.impl.DefaultRepositorySystem Java Examples

The following examples show how to use org.eclipse.aether.internal.impl.DefaultRepositorySystem. 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: InitializeMojoTest.java    From vertx-maven-plugin with Apache License 2.0 6 votes vote down vote up
private InitializeMojo createMojoInstance() throws PlexusContainerException {
    InitializeMojo mojo = new InitializeMojo();
    mojo.project = new MavenProject();
    mojo.repositorySystem = new DefaultRepositorySystem();
    mojo.repositorySystemSession = new DefaultRepositorySystemSession();
    mojo.buildPluginManager = new DefaultBuildPluginManager();
    mojo.container = new DefaultPlexusContainer(new DefaultContainerConfiguration());
    mojo.mavenSession = new MavenSession(mojo.container, mojo.repositorySystemSession, new DefaultMavenExecutionRequest(),
        new DefaultMavenExecutionResult());

    mojo.lifecycleExecutor = new DefaultLifecycleExecutor();
    mojo.scmManager = new DefaultScmManager();
    mojo.remoteRepositories = Collections.emptyList();
    mojo.projectBuildDir = OUT.getAbsolutePath();

    Build build = new Build();
    build.setOutputDirectory(OUT.getAbsolutePath());
    mojo.project.setBuild(build);

    return mojo;
}
 
Example #2
Source File: ResolveMojoTest.java    From roboconf-platform with Apache License 2.0 6 votes vote down vote up
private RepositorySystem newRepositorySystem() {

		RepositorySystem repoSystem = new DefaultRepositorySystem() {
			@Override
			public ArtifactResult resolveArtifact( RepositorySystemSession session, ArtifactRequest request )
			throws ArtifactResolutionException {

				ArtifactResult res = new ArtifactResult( request );
				Artifact mavenArtifact = ResolveMojoTest.this.artifactIdToArtifact.get( request.getArtifact().getArtifactId());
				if( mavenArtifact == null )
					throw new ArtifactResolutionException( new ArrayList<ArtifactResult>( 0 ), "Error in test wrapper and settings." );

				org.eclipse.aether.artifact.DefaultArtifact art =
						new org.eclipse.aether.artifact.DefaultArtifact(
								"groupId", "artifactId", "classifier", "extension", "version",
								null, mavenArtifact.getFile());

				res.setArtifact( art );
				return res;
			}
		};

		return repoSystem;
	}
 
Example #3
Source File: DependencyResolver.java    From start.spring.io with Apache License 2.0 5 votes vote down vote up
private static ServiceLocator createServiceLocator() {
	DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
	locator.addService(RepositorySystem.class, DefaultRepositorySystem.class);
	locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
	locator.addService(TransporterFactory.class, DependencyResolver.JarSkippingHttpTransporterFactory.class);
	return locator;
}
 
Example #4
Source File: MavenResolverDependencyManagementVersionResolver.java    From initializr with Apache License 2.0 5 votes vote down vote up
private static ServiceLocator createServiceLocator() {
	DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
	locator.addService(RepositorySystem.class, DefaultRepositorySystem.class);
	locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
	locator.addService(TransporterFactory.class, HttpTransporterFactory.class);
	return locator;
}