Skip to content
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

Using git commit hash with Artifactory Maven Plugin #594

Closed
artespoon opened this issue Aug 15, 2022 · 1 comment
Closed

Using git commit hash with Artifactory Maven Plugin #594

artespoon opened this issue Aug 15, 2022 · 1 comment
Labels
Milestone

Comments

@artespoon
Copy link

Description

I would like to add git commit hash as a suffix to my jar file using git-commit-id-maven-plugin and then deploy it to artifactory using artifactory-maven-plugin.

I'm able to produce a local jar file with a git commit hash in the target folder. But when I run mvn deploy it gets published to artifactory with the default version (no git commit hash).

I tried to follow solution mentioned in the FAQ, but don't know if this workaround can be used for artifactory maven plugin.

Expected behavior

I would like to be able to publish to artifactory jar file with version and git commit hash.

Additional context

  • maven version: 3.8.2
  • git-commit-id-maven-plugin version: 5.0.0
  • artifactory-maven-plugin: 3.2.3
  • maven command: mvn clean deploy
@TheSnoozer
Copy link
Collaborator

Hello,
thanks for creating this ticket!
Indeed reading up on this again I see the following
https://github.com/git-commit-id/git-commit-id-maven-plugin/blob/master/docs/faq.md#generated-properties-are-not-being-used-in-install-andor-deploy

This specific behaviour is basically not intended / not supported by maven-install-plugin and/or maven-deploy-plugin (https://issues.apache.org/jira/browse/MINSTALL-1 / https://issues.apache.org/jira/browse/MDEPLOY-93). The naming format in the remote repo seems to be always $artifactId-$version-$classifier by default and thus any generated property will not end up inside the artifact being installed/deployed.

the initial workaround was suggested in
#256 (comment)

And in a nutshell you disable the default install/deploy and replace it with a custom version (the one that deploys your custom version.

For full reference here is a full project that demonstrates the behaviour.
example-594.zip

Depending on the target location where you deploy the file to you might need add an extra dependency (as outlined in https://maven.apache.org/plugins/maven-site-plugin/examples/adding-deploy-protocol.html). Supported protocols are mentioned in https://maven.apache.org/wagon/.

However I need to stress that this might not be something fully supported or intended by the maven eco-system. So use this at your own risk. I will also not provide further support on this matter.

TheSnoozer added a commit that referenced this issue Feb 28, 2024
Add more clear instructions on how to the the git commit id maven plugin to publish a custom
@TheSnoozer TheSnoozer added this to the 7.0.1 milestone Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants