Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Maven How to build the dependent projects that are added as the dependencies in the main project when building the main project?

Tags:

java

maven

I have 3 independent projects in my main project. When I want to add the dependencies of these projects to main project, then first I am building the dependent projects and then finally building the main project. Is there is a way to build the dependent projects at the time of building the main project?

like image 537
krishna prasad Avatar asked Nov 29 '25 23:11

krishna prasad


1 Answers

Sure, use a multi-module project

<project xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                      http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.company</groupId>
  <version>1.0-SNAPSHOT</version>
  <artifactId>someName</artifactId>
  <name>someName</name>
  <packaging>pom</packaging>
  <modules>
    <module>dependentProject1</module>
    <module>dependentProject2</module>
    <module>mainProject</module>
  </modules>
</project>
like image 84
snIp Avatar answered Dec 02 '25 14:12

snIp



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!