Search in sources :

Example 31 with DefaultArtifactHandler

use of org.apache.maven.artifact.handler.DefaultArtifactHandler in project maven-plugins by apache.

the class RemoteResourcesMojoTest method testSimpleBundles.

public void testSimpleBundles() throws Exception {
    final MavenProjectResourcesStub project = createTestProject("default-simplebundles");
    final ProcessRemoteResourcesMojo mojo = lookupProcessMojoWithSettings(project, new String[] { "test:test:1.0" });
    setupDefaultProject(project);
    ArtifactRepository repo = (ArtifactRepository) getVariableValueFromObject(mojo, "localRepository");
    String path = repo.pathOf(new DefaultArtifact("test", "test", VersionRange.createFromVersion("1.0"), null, "jar", "", new DefaultArtifactHandler()));
    File file = new File(repo.getBasedir() + "/" + path + ".jar");
    file.getParentFile().mkdirs();
    buildResourceBundle("default-simplebundles-create", null, new String[] { "SIMPLE.txt" }, file);
    mojo.execute();
    file = (File) getVariableValueFromObject(mojo, "outputDirectory");
    file = new File(file, "SIMPLE.txt");
    assertTrue(file.exists());
}
Also used : MavenProjectResourcesStub(org.apache.maven.plugin.resources.remote.stub.MavenProjectResourcesStub) DefaultArtifactHandler(org.apache.maven.artifact.handler.DefaultArtifactHandler) ArtifactRepository(org.apache.maven.artifact.repository.ArtifactRepository) File(java.io.File) DefaultArtifact(org.apache.maven.artifact.DefaultArtifact)

Aggregations

DefaultArtifactHandler (org.apache.maven.artifact.handler.DefaultArtifactHandler)31 DefaultArtifact (org.apache.maven.artifact.DefaultArtifact)29 Artifact (org.apache.maven.artifact.Artifact)21 File (java.io.File)20 ArtifactHandler (org.apache.maven.artifact.handler.ArtifactHandler)8 ArtifactRepository (org.apache.maven.artifact.repository.ArtifactRepository)8 VersionRange (org.apache.maven.artifact.versioning.VersionRange)7 MavenProjectResourcesStub (org.apache.maven.plugin.resources.remote.stub.MavenProjectResourcesStub)7 MavenProject (org.apache.maven.project.MavenProject)6 IOException (java.io.IOException)3 InputStream (java.io.InputStream)3 Map (java.util.Map)3 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)3 FileInputStream (java.io.FileInputStream)2 Path (java.nio.file.Path)2 RemoteException (java.rmi.RemoteException)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Random (java.util.Random)2 ArtifactMetadataSource (org.apache.maven.artifact.metadata.ArtifactMetadataSource)2