Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reference one maven project from another maven project?

Tags:

java

maven

I have an in-development library project (module by IntelliJ definition) that i want to reference from other projects. How would i go about to reference that project in other projects ?

like image 414
Dante Avatar asked Dec 18 '25 03:12

Dante


2 Answers

you can use whether Dependency or module tags in pom.xml of your project. Depends on what you trying to do.

<dependency>
        <groupId>com.mysubpro</groupId>
        <artifactId>myproject</artifactId>
        <version>1.0-SNAPSHOT</version>
</dependency>  

Or

<modules>
    <module>myproject</module>
</modules>
like image 116
Morteza Adi Avatar answered Dec 20 '25 19:12

Morteza Adi


You have to use mvn install goal. This will install your library to your local repository. Link to Maven Install Plugin. Once it is done you can have a dependency to it in your other projects.

like image 34
basiljames Avatar answered Dec 20 '25 17:12

basiljames



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!