how to make maven build dependent project
build, dependencies, java, maven
Solution
You can build multiple projects together using "Modules". Normally, you would do this by creating a "mother" project with `<packaging>pom</packaging>` and adding your real project as modules using the `<modules>` tag. Then, when you build the "mother" project, all modules are automatically built in the right order.
Here is an example from the Maven by Example book:
<groupId>org.sonatype.mavenbook.multi</groupId>
<artifactId>simple-parent</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<modules>
<module>simple-weather</module>
<module>simple-webapp</module>
</modules>
Note that this requires you to have your modules in subfolders that are named accordingly. For example, you would have the "mother" pom in some folder:
/.../my-project/
and the modules in:
/.../my-project/simple-weather/
/.../my-project/simple-webapp/
For more information, read Chapter 6. A Multi-module Project of the book, it's freely available on the Sonatype website.
Problem
I have project with several dependencies on other project. ``` <?xml version="1.0" encoding="UTF-8"?> <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/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>group1</groupId> <artifactId>artifact1<artifactId> <name>RealtyRegistry</name> <packaging>war</packaging> <version>1.0.0-SNAPSHOT</version> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>group1</groupId> <artifactId>artifact2</artifactId> <version>1.0.0</version> </dependency> <dependency> <groupId>group1</groupId> <artifactId>artifact3</artifactId> <version>1.0.0</version> </dependency> </dependencies> ``` All of them developed by me simultaniously. I add edition to files of all of project and i need to build main project together with dependent ones. How to do that for projects without tree structure? There can be 2 or more covering trees for projects hierachy, for example: A depends on B,C; D depends on C,E; A and D are independent.