Search in sources :

Example 21 with DependencySet

use of org.apache.maven.plugins.assembly.model.DependencySet in project maven-plugins by apache.

the class AssemblyInterpolatorTest method testDependencySetOutputFileNameMappingsAreNotInterpolated.

public void testDependencySetOutputFileNameMappingsAreNotInterpolated() throws IOException, AssemblyInterpolationException, AssemblyReadException, InvalidAssemblerConfigurationException {
    final Model model = new Model();
    model.setArtifactId("artifact-id");
    model.setGroupId("group.id");
    model.setVersion("1");
    model.setPackaging("jar");
    final MavenProject project = new MavenProject(model);
    final Assembly assembly = new Assembly();
    // artifactId is blacklisted, but packaging is not.
    final String outputFileNameMapping = "${artifactId}.${packaging}";
    final DependencySet set = new DependencySet();
    set.setOutputFileNameMapping(outputFileNameMapping);
    assembly.addDependencySet(set);
    final PojoConfigSource configSourceStub = new PojoConfigSource();
    configSourceStub.setRootInterpolator(FixedStringSearchInterpolator.create());
    configSourceStub.setEnvironmentInterpolator(FixedStringSearchInterpolator.create());
    configSourceStub.setMavenProject(project);
    final Assembly outputAssembly = roundTripInterpolation(assembly, configSourceStub);
    final List<DependencySet> outputDependencySets = outputAssembly.getDependencySets();
    assertEquals(1, outputDependencySets.size());
    final DependencySet outputSet = outputDependencySets.get(0);
    assertEquals("${artifactId}.${packaging}", outputSet.getOutputFileNameMapping());
}
Also used : MavenProject(org.apache.maven.project.MavenProject) Model(org.apache.maven.model.Model) DependencySet(org.apache.maven.plugins.assembly.model.DependencySet) PojoConfigSource(org.apache.maven.plugins.assembly.testutils.PojoConfigSource) Assembly(org.apache.maven.plugins.assembly.model.Assembly)

Aggregations

DependencySet (org.apache.maven.plugins.assembly.model.DependencySet)21 MavenProject (org.apache.maven.project.MavenProject)16 Model (org.apache.maven.model.Model)11 ConsoleLogger (org.codehaus.plexus.logging.console.ConsoleLogger)10 ArtifactMock (org.apache.maven.plugins.assembly.archive.task.testutils.ArtifactMock)8 MockAndControlForAddDependencySetsTask (org.apache.maven.plugins.assembly.archive.task.testutils.MockAndControlForAddDependencySetsTask)8 Logger (org.codehaus.plexus.logging.Logger)8 Assembly (org.apache.maven.plugins.assembly.model.Assembly)7 File (java.io.File)6 Artifact (org.apache.maven.artifact.Artifact)6 ModuleSet (org.apache.maven.plugins.assembly.model.ModuleSet)5 HashSet (java.util.HashSet)4 Set (java.util.Set)4 LinkedHashSet (java.util.LinkedHashSet)3 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2 AddDependencySetsTask (org.apache.maven.plugins.assembly.archive.task.AddDependencySetsTask)2 FileSet (org.apache.maven.plugins.assembly.model.FileSet)2 AssemblyId (org.apache.maven.plugins.assembly.resolved.AssemblyId)2 PojoConfigSource (org.apache.maven.plugins.assembly.testutils.PojoConfigSource)2