Warn when aggregate runs on non-POM packaging - #320
kratos0718 wants to merge 1 commit into
Conversation
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.
| if (Type.POM.equals(type)) { | ||
| packageSources(reactorProjects); | ||
| } else { | ||
| getLog().warn("NOT aggregating sources as this goal requires a project with [" + Type.POM |
There was a problem hiding this comment.
I'm unsure about this. Maybe debug level? I don't know.
|
Debug would leave it effectively silent, which is the thing #306 is about — nobody runs with Warn felt right because it only fires when the goal was asked to do something it cannot do, so it isn't noise on a normal build. Your issue also suggested "a warning or info message", which is where I took it from. That said, info is a reasonable middle if warn feels too loud — it still shows on a default run. Say the word and I'll switch it. |
|
@elharo just following up, did you have a preference between warn and info for this, or is warn fine as is? Happy to switch it either way, just want to close this out. |
Fixes #306
Problem
AggregatorSourceJarMojo.doExecute()packages sources only forpompackaging: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
elsebranch and warn, naming the project and its actual packaging so the message says what to change. The wording follows the classifier warningpackageSourcesalready emits.Testing
AggregatorSourceJarMojoTestcovers both branches, overridingpackageSourcesto record the projects it receives rather than building an archive:pompackaging still packages the reactor projects, and logs nothingThe 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.