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:28 UTC
[I] AggregatorSourceJarMojo silently does nothing for non-POM packaging [maven-source-plugin]
elharo opened a new issue, #306:
URL: https://github.com/apache/maven-source-plugin/issues/306
`AggregatorSourceJarMojo.java:35-37`:
```java
@Override
protected void doExecute() throws MojoException {
if (Type.POM.equals(getProject().getPackaging().type().id())) {
packageSources(reactorProjects);
}
}
```
If the aggregator project has non-POM packaging, the method returns without any warning or error message. While `@Mojo(aggregator = true)` typically implies POM packaging, a misleading build or configuration could lead to silent failure — no source JAR is produced and the user receives no indication why.
**Fix**: Add an `else` branch with a warning or info message explaining why no sources were packaged.
--
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] AggregatorSourceJarMojo silently does nothing for non-POM packaging [maven-source-plugin]
Posted by "kratos0718 (via GitHub)" <gi...@apache.org>.
kratos0718 commented on issue #306:
URL: https://github.com/apache/maven-source-plugin/issues/306#issuecomment-5267303750
Good question, and I think a warning is the safer choice here.
Today an aggregator run against a non-POM project **succeeds silently** — it just produces no source JAR. Switching that to a failure would break builds that pass right now, and the people most likely to hit it are exactly those with an incidental aggregator binding they never noticed. That is a behavioural change rather than a bug fix.
The actual complaint in this issue is diagnosability, not permissiveness: the user gets no indication why nothing was produced. A warning naming the project and its real packaging solves that completely, without breaking anyone:
```
[WARNING] Not packaging sources for org.example:my-app: aggregator goal
requires "pom" packaging but project packaging is "jar".
```
That said, if the project does consider a non-POM aggregator binding to be unambiguously a misconfiguration, then failing is defensible — I would just want it tied to a major version rather than a patch, since it can turn a green build red with no change on the user's side.
Happy to implement either. Unless you would rather have the failure, I will open a PR with the warning plus a test asserting the message is emitted and that the build still succeeds.
--
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] AggregatorSourceJarMojo silently does nothing for non-POM packaging [maven-source-plugin]
Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo closed issue #306: AggregatorSourceJarMojo silently does nothing for non-POM packaging
URL: https://github.com/apache/maven-source-plugin/issues/306
--
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] AggregatorSourceJarMojo silently does nothing for non-POM packaging [maven-source-plugin]
Posted by "kratos0718 (via GitHub)" <gi...@apache.org>.
kratos0718 commented on issue #306:
URL: https://github.com/apache/maven-source-plugin/issues/306#issuecomment-5192241157
Taking this one.
Planning to add the `else` branch with a warning naming the project and its actual packaging, in the style of the existing classifier warning in `packageSources`, plus a unit test covering both branches — that `packageSources` runs for `pom` packaging and that non-POM packaging warns instead of returning silently.
--
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] AggregatorSourceJarMojo silently does nothing for non-POM packaging [maven-source-plugin]
Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo commented on issue #306:
URL: https://github.com/apache/maven-source-plugin/issues/306#issuecomment-5197420929
I wonder if this one should fail instead of logging?
--
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