Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Different groupId (and version) for a same Maven project

I have a project in which a Maven project is deployed in two different ways using two groupIds and different versions. For example:

a) Depends on a branch (using jitpack):

    <dependency>
        <groupId>com.github.user</groupId>
        <artifactId>myProj</artifactId>
        <version>aaaaaa-SNAPSHOT</version>
    </dependency>

b) Depends on a ... version (other source):

    <dependency>
        <groupId>org.user</groupId>
        <artifactId>myProj</artifactId>
        <version>1.0.0-SNAPSHOT</version>
    </dependency>

I am using method a). My project also depends on some other project which deploys method b). I don't know, how can I override the b) or how can I tell Maven that these are same project and ask them to use a).

This provides a way to use same project with different artefact names using classifier. I also looked on Dependency Management but could not really understand. I am not an expert in this field.

like image 525
novice Avatar asked Aug 31 '25 01:08

novice


1 Answers

With respect to Maven, the two dependencies are different and hence cannot be overridden.

But you can use exclusions (detailed description in Optional Dependencies and Dependency Exclusions) to remove any transitive dependency.

like image 151
Subir Kumar Sao Avatar answered Sep 02 '25 14:09

Subir Kumar Sao