Skip to content

Warn when aggregate runs on non-POM packaging - #320

Open
kratos0718 wants to merge 1 commit into
apache:masterfrom
kratos0718:fix/306-aggregate-warns-on-non-pom-packaging
Open

Warn when aggregate runs on non-POM packaging#320
kratos0718 wants to merge 1 commit into
apache:masterfrom
kratos0718:fix/306-aggregate-warns-on-non-pom-packaging

Conversation

@kratos0718

Copy link
Copy Markdown
Contributor

Fixes #306

Problem

AggregatorSourceJarMojo.doExecute() packages sources only for pom packaging:

protected void doExecute() throws MojoException {
    if (Type.POM.equals(getProject().getPackaging().type().id())) {
        packageSources(reactorProjects);
    }
}

Any other packaging falls off the end of the method. No archive is produced and nothing is logged, so there is no way to tell the skip apart from a build that simply did not reach the goal.

Fix

Add the else branch and warn, naming the project and its actual packaging so the message says what to change. The wording follows the classifier warning packageSources already emits.

Testing

AggregatorSourceJarMojoTest covers both branches, overriding packageSources to record the projects it receives rather than building an archive:

  • pom packaging still packages the reactor projects, and logs nothing
  • non-POM packaging packages nothing and warns, with the message naming the packaging and the project

The second fails against the silent version with Wanted but not invoked; the first passes either way, since that branch is unchanged. mvn verify -DskipITs: 12 tests, all passing.

AggregatorSourceJarMojo.doExecute() packages sources only for pom
packaging and otherwise returns without a word, so a project that reaches
the goal with some other packaging gets no source archive and no
indication of why.

Warn instead, naming the project and its actual packaging, in the style
of the classifier warning packageSources already emits.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AggregatorSourceJarMojo silently does nothing for non-POM packaging

1 participant