You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "elharo (via GitHub)" <gi...@apache.org> on 2026/07/20 22:02:26 UTC

[I] TestSourceJarMojo forks to generate-sources instead of generate-test-sources [maven-source-plugin]

elharo opened a new issue, #304:
URL: https://github.com/apache/maven-source-plugin/issues/304

   `TestSourceJarMojo.java:28` has `@Execute(phase = "generate-sources")`:
   
   ```java
   @Mojo(name = "test-jar", defaultPhase = "package")
   @Execute(phase = "generate-sources")
   public class TestSourceJarMojo extends TestSourceJarNoForkMojo {
   ```
   
   This is a test-jar goal but forks only to `generate-sources`, not `generate-test-sources`. If test sources are generated by another plugin in the `generate-test-sources` phase, they will not be available when the mojo runs, leading to an empty or incomplete test sources JAR.
   
   Compare with `TestSourceGeneratedJarMojo.java:28` which correctly uses `generate-test-sources`:
   
   ```java
   @Mojo(name = "generated-test-jar", defaultPhase = "package")
   @Execute(phase = "generate-test-sources")
   public class TestSourceGeneratedJarMojo extends TestSourceJarNoForkMojo {
   ```
   
   **Fix**: Change the phase to `generate-test-sources`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] TestSourceJarMojo forks to generate-sources instead of generate-test-sources [maven-source-plugin]

Posted by "kratos0718 (via GitHub)" <gi...@apache.org>.
kratos0718 commented on issue #304:
URL: https://github.com/apache/maven-source-plugin/issues/304#issuecomment-5192150379

   I'd like to take this one.
   
   Planning to change the fork phase to `generate-test-sources` and extend the `test-jar` IT to cover it. That IT currently only generates sources in `generate-sources`, so it passes either way — adding a `generate-test-sources` execution and asserting its output lands in the test-sources jar makes it fail on the current phase and pass after the change. That mirrors what `test-jar-generated` already does for the `generated-test-jar` goal.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] TestSourceJarMojo forks to generate-sources instead of generate-test-sources [maven-source-plugin]

Posted by "kratos0718 (via GitHub)" <gi...@apache.org>.
kratos0718 commented on issue #304:
URL: https://github.com/apache/maven-source-plugin/issues/304#issuecomment-5199375166

   Disregard my earlier note about taking this — I hadn't spotted #316 was already open. Closed my PR in favour of it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] TestSourceJarMojo forks to generate-sources instead of generate-test-sources [maven-source-plugin]

Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo commented on issue #304:
URL: https://github.com/apache/maven-source-plugin/issues/304#issuecomment-5198175772

   There's already a PR open on this.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org