This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-source-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 190304b  Test that pom-packaged projects get no source archive
190304b is described below

commit 190304b4adb10d73cae1e41466924a876755ca62
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Thu Nov 26 21:19:45 2026 +0000

    Test that pom-packaged projects get no source archive
    
    The project-005 fixture's pom packaging is ignored because ProjectStub 
supplies the project; that test only covers the no-source-roots case.
---
 .../plugins/source/SourceJarMojoOptionsTest.java   | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git 
a/src/test/java/org/apache/maven/plugins/source/SourceJarMojoOptionsTest.java 
b/src/test/java/org/apache/maven/plugins/source/SourceJarMojoOptionsTest.java
index 6fa8b7e..0b873e3 100644
--- 
a/src/test/java/org/apache/maven/plugins/source/SourceJarMojoOptionsTest.java
+++ 
b/src/test/java/org/apache/maven/plugins/source/SourceJarMojoOptionsTest.java
@@ -169,4 +169,28 @@ class SourceJarMojoOptionsTest extends 
AbstractSourcePluginTest {
         assertFalse(getTestSourceArchive(new File(tempDir, 
"target")).exists());
         assertTrue(project.getAttachedArtifacts().isEmpty());
     }
+
+    @Test
+    @InjectMojo(goal = "jar")
+    @Basedir("/unit/project-011")
+    void testJarSkipsPomPackagingEvenWithSources(SourceJarMojo mojo) throws 
Exception {
+        project.setPackaging("pom");
+
+        mojo.execute();
+
+        assertFalse(getSourceArchive(new File(tempDir, "target")).exists());
+        assertTrue(project.getAttachedArtifacts().isEmpty());
+    }
+
+    @Test
+    @InjectMojo(goal = "test-jar")
+    @Basedir("/unit/project-012")
+    void testTestJarSkipsPomPackagingEvenWithSources(TestSourceJarMojo mojo) 
throws Exception {
+        project.setPackaging("pom");
+
+        mojo.execute();
+
+        assertFalse(getTestSourceArchive(new File(tempDir, 
"target")).exists());
+        assertTrue(project.getAttachedArtifacts().isEmpty());
+    }
 }

Reply via email to