title: How to use Maven to build a Java EE project with Java class references to several dependent Java projects?
body: <p>I'm a rookie in Maven and recently I started using Maven to manage our Java EE project. The most important job is to build a project which depends on several other projects for Java classes. Firstly, I found it cannot detect these Java class even though I configured these Java projects as library references in the main project and Deployment Assembly, so I tried another approach. I exported these dependent projects to jars and then created a Maven dependency using the following command line:</p>
  
  <p><strong><code>mvn install:install-file -DgroupId=MY_GROUP_ID -DartifactId=ARTIFACT_ID -Dversion=1.0.0 -Dpackaging=jar -Dfile=MY_JAR.jar</code></strong></p>
  
  <p>And then I added these dependencies in the main project's pom.xml, and it absolutely works. But this approach is very hard to popularize among our team members, since it requires manually running a script.</p>
  
  <p>So I'm wondering if there is a plugin for Maven can meet my goal, to build a main project with the project references without exporting dependent projects to jars. I tried to use Modules in pom.xml but It shows error as below:</p>
  
  <p><strong><code>Project build error: 'packaging' with value 'war' is invalid. Aggregator projects require 'pom' as packaging.</code></strong></p>
  
  <p>Can anybody help me? Thanks very much.</p>