Search in sources :

Example 61 with MavenProject

use of org.apache.maven.project.MavenProject in project maven-plugins by apache.

the class DefaultAssemblyReaderTest method testGetAssemblyForDescriptorReference_ShouldReadBinaryAssemblyRef.

public void testGetAssemblyForDescriptorReference_ShouldReadBinaryAssemblyRef() throws IOException, AssemblyReadException, InvalidAssemblerConfigurationException {
    final File basedir = fileManager.createTempDir();
    expect(configSource.getBasedir()).andReturn(basedir).anyTimes();
    expect(configSource.getProject()).andReturn(new MavenProject(new Model())).anyTimes();
    expect(configSource.isIgnoreMissingDescriptor()).andReturn(false).anyTimes();
    DefaultAssemblyArchiverTest.setupInterpolators(configSource);
    mockManager.replayAll();
    final Assembly result = new DefaultAssemblyReader().getAssemblyForDescriptorReference("bin", configSource);
    assertEquals("bin", result.getId());
    mockManager.verifyAll();
}
Also used : MavenProject(org.apache.maven.project.MavenProject) Model(org.apache.maven.model.Model) File(java.io.File) Assembly(org.apache.maven.plugins.assembly.model.Assembly)

Example 62 with MavenProject

use of org.apache.maven.project.MavenProject in project maven-plugins by apache.

the class AssemblyExpressionEvaluatorTest method testShouldResolveModelGroupId.

public void testShouldResolveModelGroupId() throws ExpressionEvaluationException {
    final Model model = new Model();
    model.setArtifactId("artifact-id");
    model.setGroupId("group.id");
    model.setVersion("1");
    model.setPackaging("jar");
    configSourceStub.setMavenProject(new MavenProject(model));
    setupInterpolation();
    final Object result = new AssemblyExpressionEvaluator(configSourceStub).evaluate("assembly.${groupId}");
    assertEquals("assembly.group.id", result);
}
Also used : MavenProject(org.apache.maven.project.MavenProject) Model(org.apache.maven.model.Model)

Example 63 with MavenProject

use of org.apache.maven.project.MavenProject in project maven-plugins by apache.

the class ReaderFormatterTest method createBasicMavenProject.

private MavenProject createBasicMavenProject() {
    final Model model = new Model();
    model.setArtifactId("anArtifact");
    model.setGroupId("group");
    model.setVersion("version");
    return new MavenProject(model);
}
Also used : MavenProject(org.apache.maven.project.MavenProject) Model(org.apache.maven.model.Model)

Example 64 with MavenProject

use of org.apache.maven.project.MavenProject in project maven-plugins by apache.

the class AssemblyExpressionEvaluatorTest method testShouldReturnUnchangedInputForUnresolvedExpression.

public void testShouldReturnUnchangedInputForUnresolvedExpression() throws ExpressionEvaluationException {
    final Model model = new Model();
    model.setArtifactId("artifact-id");
    model.setGroupId("group.id");
    model.setVersion("1");
    model.setPackaging("jar");
    configSourceStub.setMavenProject(new MavenProject(model));
    setupInterpolation();
    final Object result = new AssemblyExpressionEvaluator(configSourceStub).evaluate("assembly.${unresolved}");
    assertEquals("assembly.${unresolved}", result);
}
Also used : MavenProject(org.apache.maven.project.MavenProject) Model(org.apache.maven.model.Model)

Example 65 with MavenProject

use of org.apache.maven.project.MavenProject in project maven-plugins by apache.

the class AssemblyExpressionEvaluatorTest method testShouldResolveModelPropertyBeforeModelGroupId.

public void testShouldResolveModelPropertyBeforeModelGroupId() throws ExpressionEvaluationException {
    final Model model = new Model();
    model.setArtifactId("artifact-id");
    model.setGroupId("group.id");
    model.setVersion("1");
    model.setPackaging("jar");
    final Properties props = new Properties();
    props.setProperty("groupId", "other.id");
    model.setProperties(props);
    configSourceStub.setMavenProject(new MavenProject(model));
    setupInterpolation();
    final Object result = new AssemblyExpressionEvaluator(configSourceStub).evaluate("assembly.${groupId}");
    assertEquals("assembly.other.id", result);
}
Also used : MavenProject(org.apache.maven.project.MavenProject) Model(org.apache.maven.model.Model) Properties(java.util.Properties)

Aggregations

MavenProject (org.apache.maven.project.MavenProject)297 File (java.io.File)138 Artifact (org.apache.maven.artifact.Artifact)66 ArrayList (java.util.ArrayList)64 Model (org.apache.maven.model.Model)57 ConsoleLogger (org.codehaus.plexus.logging.console.ConsoleLogger)36 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)33 IOException (java.io.IOException)29 Assembly (org.apache.maven.plugins.assembly.model.Assembly)28 EasyMockSupport (org.easymock.classextension.EasyMockSupport)27 ArtifactMock (org.apache.maven.plugins.assembly.archive.task.testutils.ArtifactMock)20 Test (org.junit.Test)17 HashMap (java.util.HashMap)16 HashSet (java.util.HashSet)16 MavenSession (org.apache.maven.execution.MavenSession)16 DependencySet (org.apache.maven.plugins.assembly.model.DependencySet)16 ProjectBuildingException (org.apache.maven.project.ProjectBuildingException)16 LinkedHashSet (java.util.LinkedHashSet)15 ArtifactRepository (org.apache.maven.artifact.repository.ArtifactRepository)15 FileSet (org.apache.maven.plugins.assembly.model.FileSet)15