0

I have a Maven Project (A) that is depending on a Maven Project (B). Now i need to change a few things in Maven Project (B) but my boss won't let me till I show him the changes works in my local environment.

So what i have in the pom.xml is in Maven Project (A) is:

        <dependency>
            <groupId>com.company.name.network</groupId>
            <artifactId>network-project-B</artifactId>
            <version>1.1.0-SNAPSHOT</version>
        </dependency>

So i edit in my local environment project B with the changes I wanted and now i would like to edit the dependency in pom.xml project A to point to my local directory and not to the repository. Something like:

        <dependency>
            <groupId>com.company.name.network</groupId>
            <artifactId>network-project-B</artifactId>
            <version>C:/users/my_name/projectB</version>
        </dependency>

If I achieve that, i can keep making changes to Project B and see how they impact to project A without having to upload the changes to the repository.

Is that possible? I am sorry to ask this here but i am seeing others post similar but because my little knowledge in the framework i cannot understand it.

Thanks

  • Does this answer your question? [Maven: add a dependency to a jar by relative path](https://stackoverflow.com/questions/2229757/maven-add-a-dependency-to-a-jar-by-relative-path) – Ascendise Nov 15 '22 at 13:05
  • 1
    If the version is -SNAPSHOT, Maven will happily overwrite the jar with newer ones. Actually, for your local repository ($HOME/.m2/repository/), I think it overwrites stable versions too. So, just go to project B and do an `mvn install`. It will build it with your changes and deploy the updated jar *locally*, from where project A can pick it up with no changes in the dependency. – Nikos Paraskevopoulos Nov 15 '22 at 13:05
  • @NikosParaskevopoulos So what do you refer for mvn install. Project B is already a Maven project that i pull from the repository. After I pull the Project B from the repository I did the changes and build the project in IntellyJ. But when I go to Project A the changes (add a getter to a class) still is not being recognized. – Víctor Rosillo Nov 15 '22 at 13:23
  • I think you need to run mvn deploy and not mvn install. 'deploy' command will deploy it to your local repository on your local computer. (usually in m2 folder). But it is a repository known to your maven for the other project. And it will be visible – Michael Gantman Nov 15 '22 at 13:25
  • But when i runnit the test fails with the follwing message: "The forked VM terminated without saying properly goodbye. VM crash or System.exit called ?" I do not need to execute tests as i only added a getter into a class. So how can i skip the test from the intellyj run install in edit configurations? Also it looks like my user/.m2/repository/project is being updated, but still i cannot make use of the getter i just added... – Víctor Rosillo Nov 15 '22 at 13:49

0 Answers0