'How to make Maven deploy using a different, ad-hoc group Id?

Some background:

  • I have copied the master branch of an external github repository, not owned by me, into a personal repository
  • This repo contains a Java project and uses Maven for building and compilation
  • The group ID defined in all pom.xml files is org.mylibrary (let's assume)
  • When deploying to Artifactory, the deployment is done to myrepo/org/mylibrary/...

I'd like to deploy instead to:

  • myrepo/org/myorganization/mylibrary

but I would like to avoid editing all the pom.xml files, and replacing all lines containing: <groupId>org.mylibrary</groupId> with: <groupId>org.myorganization.mylibrary</groupId>.

I'm configuring the deployment via the distributionManagement element:

<distributionManagement>
<repository>
  <name>releases</name>
  <id>deployment.credentials</id>
  <url>https://artifactory.lab.myorg.org/artifactory/myrepo</url>
</repository>
</distributionManagement>

What's a clean way of solving this? Replacing the groupId definition in all pom.xml files does the trick, but, as said, that's something I want to avoid.

Thanks!



Solution 1:[1]

When deploying to any repository, Artifactory utilizes the layout that is configured for this repository. By default, for Maven repositories, Artifactory uses the "maven-default" layout.

I would recommend you to first add your requested layout and then configure your repository with the newly created layout.

I hope this information is found helpful.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Yonatan Brand