New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
maven-publish publishes jars with wrong extension for known jar packagings like 'ejb' in 5.6 #10555
Comments
This is caused by the reimplementation of part of the publishing in #9445 and the absence of test coverage for this special casing of handling the 'packaging' attribute. |
In Gradle 6 we will no longer automatically change the file extension of an artifact based on the pom packaging - see #10607. That change also fixes this issue. In case we consider another patch release for the 5.x release line, the following commit can be picked to restore the 5.5 behavior: a426d6e |
@jjohannes To make sure I understand clearly... older than 5.6, we publish a jar but the POM would say packaging is ejb. From the commit above, it seems like there will be more changes in 6.0 to address non-jar publications? Ignoring what we used to do, which is more correct/intended by Maven? Should the packaging from the POM always match the extension of the published artifact or does it not really matter? |
Adding my two cents here: I'm the maintainer of a gradle-plugin which allows building maven-plugins with gradle and I just ran into the same problem. A maven-plugin has to publish a I therefore use something like this: publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom.packaging = "maven-plugin"
}
}
} This worked fine up until Gradle 5.5.1, but is broken with 5.6, 5.6.1 and 5.6.2 Therefore I'd answer this:
No, a mismatch between the pom |
@big-guy you understood correctly. @larsgrefer thanks for clarifying. It's correct what you wrote. There is just one gotcha, which eventually let to this regression. If you use a "non-known" extension as packaging, Maven (and Gradle) also look for an artifact where the packaging is the extension. I believe that is a mechanism to allow discovery of "non-jar" artifacts as there is no other way in the POM format to define those. So if you use something like The regression in 5.6 is that this list is not honored in our reimplementation of publishing. So for any packaging, the extension is now changed. The general problem is that changing the extension late in the publishing process breaks other things in Gradle. That's why for 6.0 we want to get rid of this "magic" completely in the publishing plugin. So in |
Closing as this was merged to 5.6.3 |
Original report: https://discuss.gradle.org/t/changed-behaviour-in-maven-publish-between-5-5-and-5-6
replace
pom.packaging = "ejb"
with
pom.withXml { asNode().appendNode("packaging", "ejb") }
Reproducing Example
When building with 5.5.1 the resulting files are:
When building with 5.6.2, the resulting files are:
The text was updated successfully, but these errors were encountered: