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
base: master
Are you sure you want to change the base?
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.
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? |
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.