-
Notifications
You must be signed in to change notification settings - Fork 65
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
[MDEPLOY-311] Pass on 'packaging' when creating artifact to upload #42
Conversation
Ping - any feedback on this PR / issue? |
your assumptions is wrong, |
@@ -276,6 +276,45 @@ public void testDeployIfArtifactIsNotJar() throws Exception { | |||
assertTrue(file.exists()); | |||
} | |||
|
|||
public void testDeployFileIfPackagingIsSet() throws Exception { | |||
File testPom = new File(getBasedir(), "target/test-classes/unit/deploy-file-packaging/plugin-config.xml"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is missing in PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
Artifact mainArtifact = new DefaultArtifact( | ||
groupId, artifactId, classifier, isFilePom ? "pom" : getExtension(file), version) | ||
.setFile(file); | ||
Artifact mainArtifact = new DefaultArtifact(groupId, artifactId, classifier, packaging, version).setFile(file); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please look at java doc: https://maven.apache.org/resolver/apidocs/org/eclipse/aether/artifact/DefaultArtifact.html#%3Cinit%3E(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String)
fourth parameter is a file extension not packaging
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of getExtension(file)
we can use artifactType.getExtension()
as improvements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please look at java doc: https://maven.apache.org/resolver/apidocs/org/eclipse/aether/artifact/DefaultArtifact.html#%3Cinit%3E(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String)
fourth parameter is a file extension not packaging
But for some reason, before 16541da, packaging was used as the file extension. Are you saying that was never intended and was a bug?
If so, is there any way to get the old behavior back in maven-deploy-plugin 3.0?
artifactType.getExtension()
won't solve the problem, as this is only working known packaging
s. It does not cover the case -Dpackaging=completelarbitrary
where no artifactType
is known.
I have uploaded an alternative proposal: If we have an artifactType
use its extension, otherwise fall back to packaging
for unknown types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the documentation, packaging
designate the “Type of the artifact to be deployed. Retrieved from the element of the POM file if a POM file specified. Defaults to the file extension if it is not specified via command line or POM.”
The way I read it, it means that the packaging
tag takes precedence (whether from command line or from the POM), followed by the extension of the file to upload as a fallback.
I just hit this issue (MDEPLOY-311) because we generate a zip file using the truezip plugin (that relies on the extension) and then we need to deploy using a different extension.
The .epub
ebooks (used for documentation) are really .zip
files with a specific content but this is true for quite a lot of other formats as well so there really is a use-case for using <packaging>
with a different extension than the one on the deployed file.
Fixes a regression introduced in 16541da [MDEPLOY-296] which caused the -Dpackaging property to be ignored when uploading the artifact. Instead, the packaging type during upload was always derived from the file name.
Something is fishy about this PR, but I think I understand the intent.... is the generated POM/packaging wrong? |
Superded by #71 |
The packaging was not really considered. Borrow UT from PR #42, thanks! Changes: * honor packaging to calculate classifier (optionally) and extension * add param "extension" to override Maven calculated extension explicitly * switch to SLF4J logging --- https://issues.apache.org/jira/browse/MDEPLOY-311
Awesome, thanks! |
Fixes a regression introduced in
16541da [MDEPLOY-296] which caused the
-Dpackaging
property to be ignored when uploading the artifact. Instead, the packaging type during upload was always derived from the file name.Following this checklist to help us incorporate your
contribution quickly and easily:
for the change (usually before you start working on it). Trivial changes like typos do not
require a JIRA issue. Your pull request should address just this issue, without
pulling in other changes.
[MDEPLOY-XXX] - Fixes bug in ApproximateQuantiles
,where you replace
MDEPLOY-XXX
with the appropriate JIRA issue. Best practiceis to use the JIRA issue title in the pull request title and in the first line of the
commit message.
mvn clean verify
to make sure basic checks pass. A more thorough check willbe performed on your pull request automatically.
mvn -Prun-its clean verify
).If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.
I hereby declare this contribution to be licenced under the Apache License Version 2.0, January 2004
In any other case, please file an Apache Individual Contributor License Agreement.