Create a multi-module project (x) which contains a pom.xml with packaging = pom
<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>test</groupId>
<artifactId>x</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>x1</module>
<module>x2</module>
</modules>
</project>
and 2 regular (jar) projects (x1 and x2). This is how the project structure should look like
x
x1
...
pom.xml
x2
...
pom.xml
pom.xml
The main project pom should contain dependencies common to both modules. Nested projects poms should have a reference to the parent.
<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>
<parent>
<groupId>test</groupId>
<artifactId>x</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>x1</artifactId>
</project>
See more here http://maven.apache.org/guides/mini/guide-multiple-modules.html