org.apache.maven.artifact.repository.DefaultArtifactRepository Java Examples

The following examples show how to use org.apache.maven.artifact.repository.DefaultArtifactRepository. 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: DefaultVersionsHelperTest.java    From versions-maven-plugin with Apache License 2.0 6 votes vote down vote up
private DefaultVersionsHelper createHelper( String rulesUri, ArtifactMetadataSource metadataSource )
    throws MojoExecutionException
{
    final DefaultWagonManager wagonManager = new DefaultWagonManager()
    {
        public Wagon getWagon( Repository repository )
            throws UnsupportedProtocolException, WagonConfigurationException
        {
            return new FileWagon();
        }
    };

    DefaultVersionsHelper helper =
        new DefaultVersionsHelper( new DefaultArtifactFactory(), new DefaultArtifactResolver(), metadataSource, new ArrayList(),
                                   new ArrayList(),
                                   new DefaultArtifactRepository( "", "", new DefaultRepositoryLayout() ),
                                   wagonManager, new Settings(), "", rulesUri, mock( Log.class ), mock( MavenSession.class ),
                                   new DefaultPathTranslator());
    return helper;
}
 
Example #2
Source File: RunPoPlugin.java    From hyperjaxb3 with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Validate the generation of a java files from purchaseorder.xsd.
 * 
 * @throws MojoExecutionException
 */
public void testExecute() throws Exception {

	final File pom = new File(getBaseDir(),
			"pom.xml");

	final ArtifactRepository localRepository = new DefaultArtifactRepository(
			"local",

			new File(getBaseDir(), "target/test-repository").toURI()
					.toURL().toString(), new DefaultRepositoryLayout());

	final MavenProject mavenProject = mavenProjectBuilder.build(pom,
			localRepository, null);

	final Hyperjaxb3Mojo generator = (Hyperjaxb3Mojo) lookupMojo(
			"org.jvnet.hyperjaxb3",
			"hyperjaxb3-maven-plugin",
			"0.5.4-SNAPSHOT",
			"generate", null);
	generator.setProject(mavenProject);
	generator.setLocalRepository(localRepository);
	generator.setSchemaDirectory(new File(getBaseDir(),
			"src/main/resources"));
	generator.setSchemaIncludes(new String[] { "*.xsd" });
	generator.setBindingIncludes(new String[] { "*.xjb" });
	generator.setGenerateDirectory(new File(getBaseDir(),
			"target/test/generated-sources"));
	generator.setVerbose(true);
	generator.setRemoveOldOutput(true);
	generator.execute();
}
 
Example #3
Source File: RunEpisodesBPlugin.java    From hyperjaxb3 with BSD 2-Clause "Simplified" License 5 votes vote down vote up
protected void setUp() throws Exception {
	super.setUp();

	mavenProjectBuilder = (MavenProjectBuilder) getContainer().lookup(
			MavenProjectBuilder.ROLE);
	ArtifactFactory artifactFactory = (ArtifactFactory) getContainer()
			.lookup(ArtifactFactory.ROLE);

	final Map<String, Mojo> mojos = (Map<String, Mojo>) getContainer()
			.lookupMap(Mojo.ROLE);

	for (Mojo mojo : mojos.values()) {
		if (mojo instanceof Hyperjaxb3Mojo) {
			this.mojo = (Hyperjaxb3Mojo) mojo;
		}
	}

	MavenSettingsBuilder settingsBuilder = (MavenSettingsBuilder) getContainer()
			.lookup(MavenSettingsBuilder.ROLE);
	ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) getContainer()
			.lookup(ArtifactRepositoryLayout.ROLE, "default");

	Settings settings = settingsBuilder.buildSettings();

	String url = settings.getLocalRepository();

	if (!url.startsWith("file:")) {
		url = "file://" + url;
	}

	localRepository = new DefaultArtifactRepository("local", url,
			new DefaultRepositoryLayout());
}
 
Example #4
Source File: JAXBGenerateTest.java    From maven-jaxb2-plugin with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Validate the generation of a java files from purchaseorder.xsd.
 * 
 * @throws MojoExecutionException
 */
public void testExecute() throws Exception {

	final File pom = new File(getBaseDir(),
	"src/test/resources/test-pom.xml");
	
       final ArtifactRepository localRepository = new DefaultArtifactRepository( "local", 
       		
       		new File(getBaseDir(), "target/test-repository").toURI().toURL().toString()        		, new DefaultRepositoryLayout());
	
	
	final MavenProject mavenProject = mavenProjectBuilder.build(pom, localRepository, null);
	

	final XJC21Mojo generator = (XJC21Mojo) lookupMojo("generate", pom);
	generator.setProject(mavenProject);
	generator.setLocalRepository(localRepository);
	generator.setSchemaDirectory(new File(getBaseDir(),"src/test/resources/"));
	generator.setSchemaIncludes(new String[] { "*.xsd" });
	generator.setBindingIncludes(new String[] { "*.xjb" });
	generator.setGenerateDirectory(new File(getBaseDir(), "target/test/generated-sources"));
	generator.setVerbose(true);
	generator.setGeneratePackage("unittest");
	generator.setRemoveOldOutput(false);
	
	generator.execute();
}
 
Example #5
Source File: JAXBGenerateTest.java    From maven-jaxb2-plugin with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Validate the generation of a java files from purchaseorder.xsd.
 * 
 * @throws MojoExecutionException
 */
public void testExecute() throws Exception {

	final File pom = new File(getBaseDir(),
	"src/test/resources/test-pom.xml");
	
       final ArtifactRepository localRepository = new DefaultArtifactRepository( "local", 
       		
       		new File(getBaseDir(), "target/test-repository").toURI().toURL().toString()        		, new DefaultRepositoryLayout());
	
	
	final MavenProject mavenProject = mavenProjectBuilder.build(pom, localRepository, null);
	

	final XJC2Mojo generator = (XJC2Mojo) lookupMojo("generate", pom);
	generator.setProject(mavenProject);
	generator.setLocalRepository(localRepository);
	generator.setSchemaDirectory(new File(getBaseDir(),"src/test/resources/"));
	generator.setSchemaIncludes(new String[] { "*.xsd" });
	generator.setBindingIncludes(new String[] { "*.xjb" });
	generator.setGenerateDirectory(new File(getBaseDir(), "target/test/generated-sources"));
	generator.setVerbose(true);
	generator.setGeneratePackage("unittest");
	generator.setRemoveOldOutput(false);
	
	generator.execute();
}
 
Example #6
Source File: AntTaskBackedMavenPublisher.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
protected ArtifactRepository createLocalArtifactRepository() {
    ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) lookup(ArtifactRepositoryLayout.ROLE, getLocalRepository().getLayout());
    return new DefaultArtifactRepository("local", tmpDirFactory.create().toURI().toString(), repositoryLayout);
}
 
Example #7
Source File: AntTaskBackedMavenLocalPublisher.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
protected ArtifactRepository createLocalArtifactRepository() {
    ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) lookup(ArtifactRepositoryLayout.ROLE, getLocalRepository().getLayout());
    return new DefaultArtifactRepository("local", repoLocation, repositoryLayout);
}
 
Example #8
Source File: AntTaskBackedMavenPublisher.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
protected ArtifactRepository createLocalArtifactRepository() {
    ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) lookup(ArtifactRepositoryLayout.ROLE, getLocalRepository().getLayout());
    return new DefaultArtifactRepository("local", tmpDirFactory.create().toURI().toString(), repositoryLayout);
}
 
Example #9
Source File: AntTaskBackedMavenLocalPublisher.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
protected ArtifactRepository createLocalArtifactRepository() {
    ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) lookup(ArtifactRepositoryLayout.ROLE, getLocalRepository().getLayout());
    return new DefaultArtifactRepository("local", repoLocation, repositoryLayout);
}
 
Example #10
Source File: AntTaskBackedMavenPublisher.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
protected ArtifactRepository createLocalArtifactRepository() {
    ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) lookup(ArtifactRepositoryLayout.ROLE, getLocalRepository().getLayout());
    return new DefaultArtifactRepository("local", tmpDirFactory.create().toURI().toString(), repositoryLayout);
}
 
Example #11
Source File: AntTaskBackedMavenLocalPublisher.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
protected ArtifactRepository createLocalArtifactRepository() {
    ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) lookup(ArtifactRepositoryLayout.ROLE, getLocalRepository().getLayout());
    return new DefaultArtifactRepository("local", repoLocation, repositoryLayout);
}
 
Example #12
Source File: AntTaskBackedMavenPublisher.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
protected ArtifactRepository createLocalArtifactRepository() {
    ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) lookup(ArtifactRepositoryLayout.ROLE, getLocalRepository().getLayout());
    return new DefaultArtifactRepository("local", tmpDirFactory.create().toURI().toString(), repositoryLayout);
}
 
Example #13
Source File: AntTaskBackedMavenLocalPublisher.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
protected ArtifactRepository createLocalArtifactRepository() {
    ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) lookup(ArtifactRepositoryLayout.ROLE, getLocalRepository().getLayout());
    return new DefaultArtifactRepository("local", repoLocation, repositoryLayout);
}