Java Code Examples for org.apache.maven.project.MavenProject#setArtifactId()
The following examples show how to use
org.apache.maven.project.MavenProject#setArtifactId() .
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: ValidateApplicationMojoTest.java From roboconf-platform with Apache License 2.0 | 6 votes |
@Test public void testRecipe_official_anotherGroupId() throws Exception { // Find and execute the mojo ValidateApplicationMojo mojo = retriveAndPrepareMojo( "recipe" ); MavenProject project = (MavenProject) this.rule.getVariableValueFromObject( mojo, "project" ); this.rule.setVariableValueToObject( mojo, "recipe", true ); this.rule.setVariableValueToObject( mojo, "official", true ); project.setGroupId( Constants.OFFICIAL_RECIPES_GROUP_ID + ".database" ); project.setArtifactId( project.getName()); Assert.assertTrue( new File( project.getBasedir(), "readme" ).createNewFile()); mojo.execute(); // We should not have a result file File resultsFile = new File( project.getBasedir(), MavenPluginConstants.VALIDATION_RESULT_PATH ); Assert.assertFalse( resultsFile.exists()); }
Example 2
Source File: MavenUtilTest.java From jkube with Eclipse Public License 2.0 | 6 votes |
private MavenProject getMavenProject() { MavenProject mavenProject = new MavenProject(); mavenProject.setName("testProject"); mavenProject.setGroupId("org.eclipse.jkube"); mavenProject.setArtifactId("test-project"); mavenProject.setVersion("0.1.0"); mavenProject.setDescription("test description"); Build build = new Build(); build.setOutputDirectory("./target"); build.setDirectory("."); mavenProject.setBuild(build); DistributionManagement distributionManagement = new DistributionManagement(); Site site = new Site(); site.setUrl("https://www.eclipse.org/jkube/"); distributionManagement.setSite(site); mavenProject.setDistributionManagement(distributionManagement); return mavenProject; }
Example 3
Source File: AggregatingGraphFactoryTest.java From depgraph-maven-plugin with Apache License 2.0 | 6 votes |
private MavenProject createMavenProject(String artifactId) { MavenProject project = new MavenProject(); project.setArtifactId(artifactId); // Make sure that we can modify the list later. project.setCollectedProjects(new ArrayList<>()); DefaultArtifact artifact = new DefaultArtifact("groupId", artifactId, "version", "compile", "jar", "", null); project.setArtifact(artifact); RepositorySystemSession repositorySession = mock(RepositorySystemSession.class); ProjectBuildingRequest projectBuildingRequest = mock(ProjectBuildingRequest.class); when(projectBuildingRequest.getRepositorySession()).thenReturn(repositorySession); //noinspection deprecation project.setProjectBuildingRequest(projectBuildingRequest); return project; }
Example 4
Source File: ValidateApplicationMojoTest.java From roboconf-platform with Apache License 2.0 | 6 votes |
@Test public void testRecipe_official_exactGroupId() throws Exception { // Find and execute the mojo ValidateApplicationMojo mojo = retriveAndPrepareMojo( "recipe" ); MavenProject project = (MavenProject) this.rule.getVariableValueFromObject( mojo, "project" ); this.rule.setVariableValueToObject( mojo, "recipe", true ); this.rule.setVariableValueToObject( mojo, "official", true ); project.setGroupId( Constants.OFFICIAL_RECIPES_GROUP_ID ); project.setArtifactId( project.getName()); Assert.assertTrue( new File( project.getBasedir(), "readme" ).createNewFile()); mojo.execute(); // We should not have a result file File resultsFile = new File( project.getBasedir(), MavenPluginConstants.VALIDATION_RESULT_PATH ); Assert.assertFalse( resultsFile.exists()); }
Example 5
Source File: JenkinsMavenEventSpyTest.java From pipeline-maven-plugin with MIT License | 5 votes |
@Before public void before() throws Exception { reporter = new OutputStreamEventReporter(writer); spy = new JenkinsMavenEventSpy(reporter) { @Override protected boolean isEventSpyDisabled() { return false; } }; spy.init(new EventSpy.Context() { @Override public Map<String, Object> getData() { return new HashMap(); } }); MavenXpp3Reader mavenXpp3Reader = new MavenXpp3Reader(); InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream("org/jenkinsci/plugins/pipeline/maven/eventspy/pom.xml"); Assert.assertThat(in, CoreMatchers.notNullValue()); Model model = mavenXpp3Reader.read(in); project = new MavenProject(model); project.setGroupId(model.getGroupId()); project.setArtifactId(model.getArtifactId()); project.setVersion(model.getVersion()); project.setName(model.getName()); }
Example 6
Source File: MavenSessionMock.java From gitflow-incremental-builder with MIT License | 5 votes |
private static MavenProject createProject(Path path) { MavenProject project = new MavenProject(); Model model = new Model(); model.setProperties(new Properties()); project.setModel(model); project.setArtifactId(path.getFileName().toString()); project.setGroupId(path.getFileName().toString()); project.setVersion("1"); project.setFile(path.resolve("pom.xml").toFile()); return project; }
Example 7
Source File: SCMManifestCustomizerTest.java From vertx-maven-plugin with Apache License 2.0 | 5 votes |
private MavenProject createProject() { MavenProject project = new MavenProject(); project.setArtifactId("acme"); project.setGroupId("org.acme"); project.setVersion("1.0-SNAPSHOT"); return project; }
Example 8
Source File: DependencyGraphBuilderTest.java From cloud-opensource-java with Apache License 2.0 | 5 votes |
protected void setUp() throws Exception { // required for mojo lookups to work super.setUp(); File testPom = new File( getBasedir(), "target/test-classes/DependencyGraphBuilderTest/DependencyGraphBuilderTest.xml" ); mojo = (DependencyGraphBuilder) lookupMojo( "getBuildingRequest", testPom ); assertNotNull( mojo ); assertNotNull( mojo.getProject() ); MavenProject project = mojo.getProject(); MavenSession session = newMavenSession( project ); setVariableValueToObject( mojo, "session", session ); DefaultRepositorySystemSession repoSession = (DefaultRepositorySystemSession) session.getRepositorySession(); //repoSession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( stubFactory.getWorkingDir() ) ); Artifact artifact = new DefaultArtifact( "org.com.google","artifactId", "1.0.0", "compile", "jar", "C1", null); Set<Artifact> set = new HashSet<Artifact>(); set.add( artifact ); project.setArtifacts( set ); project.setArtifactId( "id" ); ArtifactHandlerManager manager = lookup( ArtifactHandlerManager.class ); setVariableValueToObject( mojo, "artifactHandlerManager", manager ); }
Example 9
Source File: MavenProjectCache.java From netbeans with Apache License 2.0 | 5 votes |
@NbBundle.Messages({ "LBL_Incomplete_Project_Name=<partially loaded Maven project>", "LBL_Incomplete_Project_Desc=Partially loaded Maven project; try building it." }) public static MavenProject getFallbackProject(File projectFile) throws AssertionError { MavenProject newproject = new MavenProject(); newproject.setGroupId("error"); newproject.setArtifactId("error"); newproject.setVersion("0"); newproject.setPackaging("pom"); newproject.setName(Bundle.LBL_Incomplete_Project_Name()); newproject.setDescription(Bundle.LBL_Incomplete_Project_Desc()); newproject.setFile(projectFile); return newproject; }
Example 10
Source File: RequirePropertyDivergesTest.java From extra-enforcer-rules with Apache License 2.0 | 5 votes |
static MavenProject createMavenProject( final String groupId, final String artifactId ) { final MavenProject project = new MavenProject(); project.setGroupId( groupId ); project.setArtifactId( artifactId ); project.setOriginalModel( new Model() ); return project; }
Example 11
Source File: IsSnapshotProjectTest.java From unleash-maven-plugin with Eclipse Public License 1.0 | 5 votes |
private static MavenProject createProject(String version) { MavenProject p = new MavenProject(); p.setGroupId("x"); p.setArtifactId("x"); p.setVersion(version); return p; }
Example 12
Source File: SPICombineTest.java From vertx-maven-plugin with Apache License 2.0 | 4 votes |
@Test public void testCombineDiffSPI() throws Exception { File jar1 = new File("target/testCombineDiffSPI.jar"); File jar2 = new File("target/testCombineDiffSPI2.jar"); File jar3 = new File("target/testCombineDiffSPI3.jar"); File jar4 = new File("target/testCombineDiffSPI4.jar"); JavaArchive jarArchive1 = ShrinkWrap.create(JavaArchive.class); jarArchive1.addAsServiceProvider("com.test.demo.DemoSPI", "com.test.demo.DemoSPI.impl.DemoSPIImpl"); jarArchive1.as(ZipExporter.class).exportTo(jar1, true); JavaArchive jarArchive2 = ShrinkWrap.create(JavaArchive.class); jarArchive2.addAsServiceProvider("com.test.demo.DemoSPI", "com.test.demo.DemoSPI.impl.DemoSPIImpl2"); jarArchive2.as(ZipExporter.class).exportTo(jar2, true); JavaArchive jarArchive3 = ShrinkWrap.create(JavaArchive.class); jarArchive3.addClass(SPICombineTest.class); jarArchive3.as(ZipExporter.class).exportTo(jar3, true); JavaArchive jarArchive4 = ShrinkWrap.create(JavaArchive.class); jarArchive4.addAsServiceProvider("com.test.demo.DemoSPI", "com.test.demo.DemoSPI.impl.DemoSPIImpl4"); jarArchive4.as(ZipExporter.class).exportTo(jar4, true); Set<Artifact> artifacts = new LinkedHashSet<>(); Artifact a1 = new DefaultArtifact("org.acme", "a1", "1.0", "compile", "jar", "", null); a1.setFile(jar1); Artifact a2 = new DefaultArtifact("org.acme", "a2", "1.0", "compile", "jar", "", null); a2.setFile(jar2); Artifact a3 = new DefaultArtifact("org.acme", "a3", "1.0", "compile", "jar", "", null); a3.setFile(jar3); Artifact a4 = new DefaultArtifact("org.acme", "a4", "1.0", "compile", "jar", "", null); a4.setFile(jar4); artifacts.add(a1); artifacts.add(a2); artifacts.add(a3); artifacts.add(a4); MavenProject project = new MavenProject(); project.setVersion("1.0"); project.setArtifactId("foo"); AbstractVertxMojo mojo = new AbstractVertxMojo() { @Override public void execute() throws MojoExecutionException, MojoFailureException { } }; mojo.setLog(new SystemStreamLog()); Build build = new Build(); build.setOutputDirectory("target/junk"); project.setBuild(build); ServiceFileCombinationConfig config = new ServiceFileCombinationConfig() .setProject(project) .setArtifacts(artifacts) .setArchive(ServiceUtils.getDefaultFatJar()) .setMojo(mojo); combiner.doCombine(config); File merged = new File("target/junk/META-INF/services/com.test.demo.DemoSPI"); assertThat(merged).isFile(); List<String> lines = FileUtils.readLines(merged, "UTF-8"); assertThat(lines).hasSize(3).containsExactly( "com.test.demo.DemoSPI.impl.DemoSPIImpl", "com.test.demo.DemoSPI.impl.DemoSPIImpl2", "com.test.demo.DemoSPI.impl.DemoSPIImpl4"); Stream.of(jar1, jar2, jar3, jar4, new File("target/junk")).forEach(FileUtils::deleteQuietly); }
Example 13
Source File: DockerAssemblyManagerTest.java From docker-maven-plugin with Apache License 2.0 | 4 votes |
private FixedStringSearchInterpolator createInterpolator(BuildImageConfiguration buildConfig) { MavenProject project = new MavenProject(); project.setArtifactId("docker-maven-plugin"); return DockerFileUtil.createInterpolator(mockMojoParams(project), buildConfig.getFilter()); }
Example 14
Source File: MavenUtilsTest.java From wisdom with Apache License 2.0 | 4 votes |
@Test public void testGetDefaultPropertiesOnProjectWithLicenses() throws Exception { Model model = new Model(); model.setPomFile(new File("target/test-classes/maven/test/minimal.xml")); MavenProject project = new MavenProject(model); project.setFile(new File("target/test-classes/maven/test/minimal.xml")); project.setArtifactId("acme"); project.setGroupId("corp.acme"); project.setVersion("1.0.0-SNAPSHOT"); final ProjectArtifact artifact = new ProjectArtifact(project); project.setArtifact(artifact); Build build = new Build(); build.setDirectory(new File(project.getBasedir(), "target").getAbsolutePath()); build.setOutputDirectory(new File(project.getBasedir(), "target/classes").getAbsolutePath()); project.setBuild(build); License license = new License(); license.setDistribution("repo"); license.setName("Apache Software License 2.0"); license.setUrl("http://www.apache.org/licenses/"); project.setLicenses(ImmutableList.of(license)); Organization organization = new Organization(); organization.setName("Acme Corp."); organization.setUrl("http://acme.org"); project.setOrganization(organization); project.setDescription("description"); Properties properties = MavenUtils.getDefaultProperties(project); assertThat(properties.getProperty(Analyzer.BUNDLE_LICENSE)).contains(license.getUrl()); assertThat(properties.getProperty(Analyzer.BUNDLE_VENDOR)).isEqualTo("Acme Corp."); assertThat(properties.getProperty(Analyzer.BUNDLE_DOCURL)).isEqualTo(organization.getUrl()); assertThat(properties.getProperty(Analyzer.BUNDLE_DESCRIPTION)).isEqualTo("description"); License license2 = new License(); license2.setDistribution("repo"); license2.setName("Apache Software License 2.0"); license2.setUrl("http://www.apache.org/LICENSE.txt"); project.setLicenses(ImmutableList.of(license, license2)); properties = MavenUtils.getDefaultProperties(project); assertThat(properties.getProperty(Analyzer.BUNDLE_LICENSE)).contains(license.getUrl()).contains(license2.getUrl()); }
Example 15
Source File: SessionTimerTest.java From maven-buildtime-extension with MIT License | 4 votes |
private MavenProject createMavenProject() { MavenProject project = new MavenProject(); project.setArtifactId("maven-project-artifact"); return project; }
Example 16
Source File: BuildTimeEventSpyTest.java From maven-buildtime-extension with MIT License | 4 votes |
private MavenProject createMavenProject() { MavenProject project = new MavenProject(); project.setArtifactId("maven-project-artifact"); return project; }
Example 17
Source File: SPICombineTest.java From vertx-maven-plugin with Apache License 2.0 | 4 votes |
@Test public void testCombineWithSpringDescriptors() throws Exception { File jar1 = new File("target/testCombine1Spring.jar"); File jar2 = new File("target/testCombine2Spring.jar"); File jar3 = new File("target/testCombine3Spring.jar"); JavaArchive jarArchive1 = ShrinkWrap.create(JavaArchive.class); jarArchive1.add(new StringAsset("com.test.demo.DemoSPI.impl.DemoSPIImpl"), "/META-INF/spring.foo"); jarArchive1.as(ZipExporter.class).exportTo(jar1, true); JavaArchive jarArchive2 = ShrinkWrap.create(JavaArchive.class); jarArchive2.add(new StringAsset("com.test.demo.DemoSPI.impl.DemoSPIImpl2"), "/META-INF/spring.foo"); jarArchive2.add(new StringAsset("com.test.demo.DemoSPI2.impl.DemoSPI2Impl2"), "/META-INF/spring.bar"); jarArchive2.as(ZipExporter.class).exportTo(jar2, true); JavaArchive jarArchive3 = ShrinkWrap.create(JavaArchive.class); jarArchive3.addClass(SPICombineTest.class); jarArchive3.as(ZipExporter.class).exportTo(jar3, true); Set<Artifact> artifacts = new LinkedHashSet<>(); Artifact a1 = new DefaultArtifact("org.acme", "a1", "1.0", "compile", "jar", "", null); a1.setFile(jar1); Artifact a2 = new DefaultArtifact("org.acme", "a2", "1.0", "compile", "jar", "", null); a2.setFile(jar2); Artifact a3 = new DefaultArtifact("org.acme", "a3", "1.0", "compile", "jar", "", null); a3.setFile(jar3); artifacts.add(a1); artifacts.add(a2); artifacts.add(a3); MavenProject project = new MavenProject(); project.setVersion("1.0"); project.setArtifactId("foo"); AbstractVertxMojo mojo = new AbstractVertxMojo() { @Override public void execute() throws MojoExecutionException, MojoFailureException { } }; mojo.setLog(new SystemStreamLog()); Build build = new Build(); build.setOutputDirectory("target/junk"); project.setBuild(build); ServiceFileCombinationConfig config = new ServiceFileCombinationConfig() .setProject(project) .setArtifacts(artifacts) .setArchive(ServiceUtils.getDefaultFatJar()) .setMojo(mojo); combiner.doCombine(config); File merged = new File("target/junk/META-INF/spring.foo"); assertThat(merged).isFile(); List<String> lines = FileUtils.readLines(merged, "UTF-8"); assertThat(lines).containsExactly("com.test.demo.DemoSPI.impl.DemoSPIImpl", "com.test.demo.DemoSPI.impl.DemoSPIImpl2"); Stream.of(jar1, jar2, jar3, new File("target/junk")).forEach(FileUtils::deleteQuietly); }
Example 18
Source File: SPICombineTest.java From vertx-maven-plugin with Apache License 2.0 | 4 votes |
@Test public void testCombineDiffSPI() throws Exception { File jar1 = new File("target/testCombineDiffSPI.jar"); File jar2 = new File("target/testCombineDiffSPI2.jar"); File jar3 = new File("target/testCombineDiffSPI3.jar"); File jar4 = new File("target/testCombineDiffSPI4.jar"); JavaArchive jarArchive1 = ShrinkWrap.create(JavaArchive.class); jarArchive1.addAsServiceProvider("com.test.demo.DemoSPI", "com.test.demo.DemoSPI.impl.DemoSPIImpl"); jarArchive1.as(ZipExporter.class).exportTo(jar1, true); JavaArchive jarArchive2 = ShrinkWrap.create(JavaArchive.class); jarArchive2.addAsServiceProvider("com.test.demo.DemoSPI", "com.test.demo.DemoSPI.impl.DemoSPIImpl2"); jarArchive2.as(ZipExporter.class).exportTo(jar2, true); JavaArchive jarArchive3 = ShrinkWrap.create(JavaArchive.class); jarArchive3.addClass(SPICombineTest.class); jarArchive3.as(ZipExporter.class).exportTo(jar3, true); JavaArchive jarArchive4 = ShrinkWrap.create(JavaArchive.class); jarArchive4.addAsServiceProvider("com.test.demo.DemoSPI", "com.test.demo.DemoSPI.impl.DemoSPIImpl4"); jarArchive4.as(ZipExporter.class).exportTo(jar4, true); Set<Artifact> artifacts = new LinkedHashSet<>(); Artifact a1 = new DefaultArtifact("org.acme", "a1", "1.0", "compile", "jar", "", null); a1.setFile(jar1); Artifact a2 = new DefaultArtifact("org.acme", "a2", "1.0", "compile", "jar", "", null); a2.setFile(jar2); Artifact a3 = new DefaultArtifact("org.acme", "a3", "1.0", "compile", "jar", "", null); a3.setFile(jar3); Artifact a4 = new DefaultArtifact("org.acme", "a4", "1.0", "compile", "jar", "", null); a4.setFile(jar4); artifacts.add(a1); artifacts.add(a2); artifacts.add(a3); artifacts.add(a4); MavenProject project = new MavenProject(); project.setVersion("1.0"); project.setArtifactId("foo"); AbstractVertxMojo mojo = new AbstractVertxMojo() { @Override public void execute() throws MojoExecutionException, MojoFailureException { } }; mojo.setLog(new SystemStreamLog()); Build build = new Build(); build.setOutputDirectory("target/junk"); project.setBuild(build); ServiceFileCombinationConfig config = new ServiceFileCombinationConfig() .setProject(project) .setArtifacts(artifacts) .setArchive(ServiceUtils.getDefaultFatJar()) .setMojo(mojo); combiner.doCombine(config); File merged = new File("target/junk/META-INF/services/com.test.demo.DemoSPI"); assertThat(merged).isFile(); List<String> lines = FileUtils.readLines(merged, "UTF-8"); assertThat(lines).hasSize(3).containsExactly( "com.test.demo.DemoSPI.impl.DemoSPIImpl", "com.test.demo.DemoSPI.impl.DemoSPIImpl2", "com.test.demo.DemoSPI.impl.DemoSPIImpl4"); Stream.of(jar1, jar2, jar3, jar4, new File("target/junk")).forEach(FileUtils::deleteQuietly); }
Example 19
Source File: SPICombineTest.java From vertx-maven-plugin with Apache License 2.0 | 4 votes |
@Test public void testCombine() throws Exception { File jar1 = new File("target/testCombine1.jar"); File jar2 = new File("target/testCombine2.jar"); File jar3 = new File("target/testCombine3.jar"); JavaArchive jarArchive1 = ShrinkWrap.create(JavaArchive.class); jarArchive1.addAsServiceProvider("com.test.demo.DemoSPI", "com.test.demo.DemoSPI.impl.DemoSPIImpl"); jarArchive1.as(ZipExporter.class).exportTo(jar1, true); JavaArchive jarArchive2 = ShrinkWrap.create(JavaArchive.class); jarArchive2.addAsServiceProvider("com.test.demo.DemoSPI", "com.test.demo.DemoSPI.impl.DemoSPIImpl2"); jarArchive2.addAsServiceProvider("com.test.demo.DemoSP2", "com.test.demo.DemoSPI2.impl.DemoSPI2Impl2"); jarArchive2.as(ZipExporter.class).exportTo(jar2, true); JavaArchive jarArchive3 = ShrinkWrap.create(JavaArchive.class); jarArchive3.addClass(SPICombineTest.class); jarArchive3.as(ZipExporter.class).exportTo(jar3, true); Set<Artifact> artifacts = new LinkedHashSet<>(); Artifact a1 = new DefaultArtifact("org.acme", "a1", "1.0", "compile", "jar", "", null); a1.setFile(jar1); Artifact a2 = new DefaultArtifact("org.acme", "a2", "1.0", "compile", "jar", "", null); a2.setFile(jar2); Artifact a3 = new DefaultArtifact("org.acme", "a3", "1.0", "compile", "jar", "", null); a3.setFile(jar3); artifacts.add(a1); artifacts.add(a2); artifacts.add(a3); MavenProject project = new MavenProject(); project.setVersion("1.0"); project.setArtifactId("foo"); AbstractVertxMojo mojo = new AbstractVertxMojo() { @Override public void execute() throws MojoExecutionException, MojoFailureException { } }; mojo.setLog(new SystemStreamLog()); Build build = new Build(); build.setOutputDirectory("target/junk"); project.setBuild(build); ServiceFileCombinationConfig config = new ServiceFileCombinationConfig() .setProject(project) .setArtifacts(artifacts) .setArchive(ServiceUtils.getDefaultFatJar()) .setMojo(mojo); combiner.doCombine(config); File merged = new File("target/junk/META-INF/services/com.test.demo.DemoSPI"); assertThat(merged).isFile(); List<String> lines = FileUtils.readLines(merged, "UTF-8"); assertThat(lines).containsExactly("com.test.demo.DemoSPI.impl.DemoSPIImpl", "com.test.demo.DemoSPI.impl.DemoSPIImpl2"); Stream.of(jar1, jar2, jar3, new File("target/junk")).forEach(FileUtils::deleteQuietly); }
Example 20
Source File: PackageMojoTest.java From vertx-maven-plugin with Apache License 2.0 | 4 votes |
@Test public void testOutputFileNameComputation() { MavenProject project = new MavenProject(); Build build = new Build(); project.setBuild(build); project.setArtifactId("some-artifact-id"); project.setVersion("1.0-SNAPSHOT"); build.setFinalName("some-artifact-id-1.0-SNAPSHOT-GA"); // output name set String fn = PackageMojo.computeOutputName(new Archive().setOutputFileName("hello"), project, null); assertThat(fn).isEqualTo("hello.jar"); // output name set with extension fn = PackageMojo.computeOutputName(new Archive().setOutputFileName("hello.jar"), project, null); assertThat(fn).isEqualTo("hello.jar"); // final name set fn = PackageMojo.computeOutputName(new Archive(), project, null); assertThat(fn).isEqualTo("some-artifact-id-1.0-SNAPSHOT-GA.jar"); // final name set with .jar build.setFinalName("some-artifact-id-1.0-SNAPSHOT-GA2.jar"); fn = PackageMojo.computeOutputName(new Archive(), project, null); assertThat(fn).isEqualTo("some-artifact-id-1.0-SNAPSHOT-GA2.jar"); // same as 1 with classifier build.setFinalName("some-artifact-id-1.0-SNAPSHOT-GA"); fn = PackageMojo.computeOutputName(new Archive(), project, "fat"); assertThat(fn).isEqualTo("some-artifact-id-1.0-SNAPSHOT-GA-fat.jar"); // same as 2 with classifier build.setFinalName("some-artifact-id-1.0-SNAPSHOT-GA2.jar"); fn = PackageMojo.computeOutputName(new Archive(), project, "fat"); assertThat(fn).isEqualTo("some-artifact-id-1.0-SNAPSHOT-GA2-fat.jar"); // no final name build.setFinalName(null); fn = PackageMojo.computeOutputName(new Archive(), project, ""); assertThat(fn).isEqualTo("some-artifact-id-1.0-SNAPSHOT.jar"); // no final name with classifier build.setFinalName(null); fn = PackageMojo.computeOutputName(new Archive(), project, "fat"); assertThat(fn).isEqualTo("some-artifact-id-1.0-SNAPSHOT-fat.jar"); }