Skip to content

TestSourceJarMojo forks to generate-sources instead of generate-test-sources #304

Open

Description

@elharo

TestSourceJarMojo.java:28 has @Execute(phase = "generate-sources"):

@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:

@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.

Activity

  1. kratos0718 commented on Aug 5, 2026

    @kratos0718
    Contributor

    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.

  2. elharo commented on Aug 5, 2026

    @elharo
    ContributorAuthor

    There's already a PR open on this.

  3. self-assigned this
    on Aug 5, 2026
  4. kratos0718 commented on Aug 6, 2026

    @kratos0718
    Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpriority:majorMajor loss of function

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions