0

In my maven project, I am looking for a way to create an artifact alias for an artifact that I have created. The reason is that a specific artifact used to be deployed under with a different artifactId and I want to keep supporting this old artifactId for the time being, even for new releases, without having to have a full duplicate module for this other artifact.

For example. Say I have the artifact foo-bar in version 1.0 of my project and I decided to rename this artifact to foo-baz in version 2.0, but I still want to support the foo-bar artifactId until the release of version 3.0, for backwards compatibility reasons.

So therefore I want to find a way to define foo-bar as an alias for foo-baz. Is this possible to do?

Rik Schaaf
  • 27
  • 2
  • take a look at this: https://stackoverflow.com/questions/9075259/multi-artifact-id-in-one-pom you can generate 2 artifacts using 2 poms in a single project – Adi Ohana May 01 '19 at 13:43
  • Ok that would indeed work well for a single module project. Would I also be able to specify this second artifact to be automatically built when I build the super pom in a multi-module project? Or would that cause problems because the pom file has a different name? – Rik Schaaf May 01 '19 at 17:40
  • This is called a [relocation](https://maven.apache.org/guides/mini/guide-relocation.html) but If I correctly remember you can't relocate an artifactId you can only relocate an groupId...Apart from that I would announce that change with the current 2.X releases and then simply change the artifactId for the first 3.X release. The decision to rename an artifact is a breaking change which in itself is a reason to make major version change..which you seemed to miss... – khmarbaise May 01 '19 at 17:51
  • Could you add the relocation as an answer @khmarbaise with an example from the link? That way future people who stumble onto this problem can see the answer immediately. – Rik Schaaf May 10 '19 at 11:30

1 Answers1

0

This is called a relocation but If I correctly remember you can't relocate an artifactId you can only relocate an groupId...Apart from that I would announce that change with the current 2.X releases and then simply change the artifactId for the first 3.X release. The decision to rename an artifact is a breaking change which in itself is a reason to make major version change..which you seemed to miss...

khmarbaise
  • 92,914
  • 28
  • 189
  • 235