Add the subproject to the parent project as follows
<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>1.0.0</modelVersion>
<groupId>Project-1.0</groupId>
<artifactId>myproject</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>Project-1.0</name>
<modules>
<module>../updater</module>
</modules>
...
</project>
Then, in the updater file of the updater project, make the following changes
<?xml version="1.0"?>
<project>
<parent>
<artifactId>myproject</artifactId>
<groupId>Project-1.0</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>Project-1.0</groupId>
<artifactId>updater</artifactId>
<version>1.0-SNAPSHOT</version>
...
</project>
When compiling the parent project, the child project will be automatically compiled.
Then, to add the jar of the subproject to your jar, add the following plugin to the parent pom.xml
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>process-resources</phase>
<configuration>
<tasks>
<copy todir="${project.build.directory}/lib">
<fileset dir="${location of updater1.0.jar}"/>
</copy>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
Abose source
share