title: Maven Link to an External Project Directory
body: <p>I need to use base code from a different project. The project folders are laid out as this:</p>
  
  <pre><code> cs4500-sinanspd-maxlever
   |
    ------ 2
   |
    ------ 3
  </code></pre>
  
  <p>so 2 &amp; 3 are subdirectories under the main folder and they are 2 SEPARATE projects. I successfully linked module 2 to module 3 in IntelliJ. </p>
  
  <p><a href="https://i.stack.imgur.com/D4aJo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/D4aJo.png" alt="enter image description here"></a> </p>
  
  <p>And I can use it. IntelliJ finds all the classes in the source folder</p>
  
  <p><a href="https://i.stack.imgur.com/CfGjU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CfGjU.png" alt="enter image description here"></a></p>
  
  <p>However when I try to compile the project 3 I get the following <strong>ERROR</strong>:</p>
  
  <pre><code>  java: package schema does not exist
  </code></pre>
  
  <p>Now I did some research but the solutions I found did not work:</p>
  
  <p><a href="https://stackoverflow.com/questions/17250741/maven-compile-package-does-not-exist">Maven compile: package does not exist</a></p>
  
  <p><a href="https://stackoverflow.com/questions/5692256/maven-best-way-of-linking-custom-external-jar-to-my-project">Maven: best way of linking custom external JAR to my project?</a></p>
  
  <p>I can not use mvn install:install-file because this is a module rather than a jar</p>
  
  <p>The pom file for project 3:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;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"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
  &lt;groupId&gt;3&lt;/groupId&gt;
  &lt;artifactId&gt;3&lt;/artifactId&gt;
  &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;2&lt;/groupId&gt;
          &lt;artifactId&gt;2&lt;/artifactId&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;3.3&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;source&gt;1.8&lt;/source&gt;
                  &lt;target&gt;1.8&lt;/target&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
   &lt;/project&gt;
  </code></pre>
  
  <p>and the iml file  shows the library path set successfully :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;module    org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true"   type="JAVA_MODULE" version="4"&gt;
    &lt;component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit- compiler-output="false"&gt;
      &lt;output url="file://$MODULE_DIR$/target/classes" /&gt;
      &lt;output-test url="file://$MODULE_DIR$/target/test-classes" /&gt;
  &lt;content url="file://$MODULE_DIR$"&gt;
    &lt;sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /&gt;
    &lt;sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /&gt;
    &lt;sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /&gt;
    &lt;excludeFolder url="file://$MODULE_DIR$/target" /&gt;
  &lt;/content&gt;
  &lt;orderEntry type="inheritedJdk" /&gt;
  &lt;orderEntry type="sourceFolder" forTests="false" /&gt;
  &lt;orderEntry type="module-library"&gt;
    &lt;library&gt;
      &lt;CLASSES&gt;
        &lt;root url="file://$MODULE_DIR$/../2" /&gt;
      &lt;/CLASSES&gt;
      &lt;JAVADOC /&gt;
      &lt;SOURCES&gt;
        &lt;root url="file://$MODULE_DIR$/../2/src/main/java" /&gt;
      &lt;/SOURCES&gt;
    &lt;/library&gt;
  &lt;/orderEntry&gt;
  &lt;orderEntry type="library" name="Maven: 2:2:1.0-SNAPSHOT" level="project" /&gt;
   &lt;/component&gt;
  &lt;/module&gt;
  </code></pre>
  
  <p>Any help is appreciated. If any other document/information is needed, please drop a comment</p>