Skip to content

Recipe to search and provide a report of relocated dependencies #58

@yeikel

Description

@yeikel

What problem are you trying to solve?

In Maven, there is a concept of relocation where library maintainers can publish a version of an artifact and provide additional metadata explaining the new coordinates where it was relocated to:

Example :

https://repo.maven.apache.org/maven2/ant/ant/1.7.0/ant-1.7.0.pom

<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>ant</groupId>
    <artifactId>ant</artifactId>
    <version>1.7.0</version>
    <distributionManagement>
        <relocation>
            <groupId>org.apache.ant</groupId>
        </relocation>
    </distributionManagement>
</project>

In this case, ant moved from the group id ant -> org.apache.ant so users would normally need to change this manually

Describe the solution you'd like

I would like a search recipe to scan the direct dependencies in my pom file, detect and report the dependencies where this happened.

In the future, we can create a separate recipes to also do the change but that's outside of the scope of this recipe as that's likely more complex. An example is described here openrewrite/rewrite-migrate-java#289

Have you considered any alternatives or workarounds?

I am not aware of any alternative. Users need to watch out for this with every upgrade.

Many library maintainers do not include this metadata(or are aware of this feature), but that's a different problem

Additional context

These changes tend to puts users at risks. it would be ideal to identify these changes automatically as part of the build process/a search recipe

Maven guide : https://maven.apache.org/guides/mini/guide-relocation.html

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions