Search in sources :

Example 56 with Assembly

use of org.apache.maven.plugins.assembly.model.Assembly 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

Assembly (org.apache.maven.plugins.assembly.model.Assembly)56 File (java.io.File)29 MavenProject (org.apache.maven.project.MavenProject)28 Model (org.apache.maven.model.Model)21 EasyMockSupport (org.easymock.classextension.EasyMockSupport)13 ConsoleLogger (org.codehaus.plexus.logging.console.ConsoleLogger)12 FileSet (org.apache.maven.plugins.assembly.model.FileSet)9 ArrayList (java.util.ArrayList)8 Component (org.apache.maven.plugins.assembly.model.Component)8 DependencySet (org.apache.maven.plugins.assembly.model.DependencySet)7 PojoConfigSource (org.apache.maven.plugins.assembly.testutils.PojoConfigSource)7 FileItem (org.apache.maven.plugins.assembly.model.FileItem)6 FileOutputStream (java.io.FileOutputStream)5 IOException (java.io.IOException)5 OutputStreamWriter (java.io.OutputStreamWriter)5 StringWriter (java.io.StringWriter)5 Writer (java.io.Writer)5 AssemblyXpp3Writer (org.apache.maven.plugins.assembly.model.io.xpp3.AssemblyXpp3Writer)5 ComponentXpp3Reader (org.apache.maven.plugins.assembly.model.io.xpp3.ComponentXpp3Reader)5 ComponentXpp3Writer (org.apache.maven.plugins.assembly.model.io.xpp3.ComponentXpp3Writer)5