GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [MDEPLOY-311] Pass on 'packaging' when creating artifact to upload by sratz · Pull Request #42 · apache/maven-deploy-plugin

Conversation

@sratz

@sratz sratz commented Jul 3, 2023

Copy link
Copy Markdown

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:

  • Make sure there is a JIRA issue filed
    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.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Format the pull request title like [MDEPLOY-XXX] - Fixes bug in ApproximateQuantiles,
    where you replace MDEPLOY-XXX with the appropriate JIRA issue. Best practice
    is to use the JIRA issue title in the pull request title and in the first line of the
    commit message.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Run mvn clean verify to make sure basic checks pass. A more thorough check will
    be performed on your pull request automatically.
  • You have run the integration tests successfully (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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@sratz

sratz commented Aug 30, 2023

Copy link
Copy Markdown
Author

Ping - any feedback on this PR / issue?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@slawekjaranowski

slawekjaranowski commented Aug 30, 2023

Copy link
Copy Markdown
Member

your assumptions is wrong,
generally packaging may be different then deployed file extension, eg
packaging ejb has extension jar

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@slawekjaranowski
slawekjaranowski requested a review from cstamas August 30, 2023 21:41
slawekjaranowski
slawekjaranowski requested changes Aug 30, 2023
View reviewed changes
Comment thread src/test/java/org/apache/maven/plugins/deploy/DeployFileMojoTest.java
}

public void testDeployFileIfPackagingIsSet() throws Exception {
File testPom = new File(getBasedir(), "target/test-classes/unit/deploy-file-packaging/plugin-config.xml");

@slawekjaranowski slawekjaranowski Aug 30, 2023

Copy link
Copy Markdown
Member

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@sratz sratz Sep 4, 2023

Copy link
Copy Markdown
Author

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java Outdated
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);

@slawekjaranowski slawekjaranowski Aug 30, 2023

Copy link
Copy Markdown
Member

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@slawekjaranowski slawekjaranowski Aug 30, 2023

Copy link
Copy Markdown
Member

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@sratz sratz Sep 4, 2023

Copy link
Copy Markdown
Author

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 packagings. 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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@EnigmaTriton EnigmaTriton Jun 13, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@sratz
[MDEPLOY-311] Pass on 'packaging' when creating artifact to upload
4e4fee1
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.
@sratz
sratz force-pushed the packaging branch from 4e1e56a to 4e4fee1 Compare September 4, 2023 13:04
@cstamas

cstamas commented Oct 23, 2023

Copy link
Copy Markdown
Member

Something is fishy about this PR, but I think I understand the intent.... is the generated POM/packaging wrong?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cstamas

cstamas commented Aug 14, 2024

Copy link
Copy Markdown
Member

Superded by #71

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cstamas cstamas closed this Aug 14, 2024
@cstamas cstamas mentioned this pull request Aug 15, 2024
[MDEPLOY-311] Consider packaging in deploy-file mojo #71
Merged
cstamas added a commit that referenced this pull request Aug 15, 2024
@cstamas
[MDEPLOY-311] Consider packaging in deploy-file mojo (#71)
14cc4c3
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
@sratz

sratz commented Aug 15, 2024

Copy link
Copy Markdown
Author

Awesome, thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sratz
sratz deleted the packaging branch August 15, 2024 15:58
@jira-importer

jira-importer commented Apr 2, 2025

Copy link
Copy Markdown

Resolve #576

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@slawekjaranowski slawekjaranowski slawekjaranowski requested changes
@cstamas cstamas Awaiting requested review from cstamas
+1 more reviewer
@EnigmaTriton EnigmaTriton EnigmaTriton left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@sratz @slawekjaranowski @cstamas @jira-importer @EnigmaTriton
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.