title: How to add local project (not jar) as a dependency to a Maven project
body: <p>I have two Maven projects that I've added to one Intellij Idea's project as two modules. Project B depends on Project A.</p>
  
  <p>Here are simplified versions of their pom.xml files.</p>
  
  <h3>Project A:</h3>
  
  <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;com.group&lt;/groupId&gt;
      &lt;artifactId&gt;a&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;jar&lt;/packaging&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;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;dependencies&gt;
      &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>
  
  <h3>Project B:</h3>
  
  <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;com.group&lt;/groupId&gt;
      &lt;artifactId&gt;b&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;jar&lt;/packaging&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;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;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.group&lt;/groupId&gt;
              &lt;artifactId&gt;a&lt;/artifactId&gt;
              &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>Project A compiles easily since it has no dependency. But Project B depends on Project A and since I'm not telling maven how to find it, it can not be compiled with <code>mvn package</code>. But if I'm not mistaken, this was possible using Intellij Idea's "Meven Projects" menu since to Intellij Idea both projects are known.</p>
  
  <p>But right now, for some unknown reason, I can not compile project B even in Intellij Idea. When I do, it prompts:</p>
  
  <pre><code>[ERROR] Failed to execute goal on project b: Could not resolve dependencies for project com.group:b:jar:1.0-SNAPSHOT: Could not find artifact com.group:a:jar:1.0-SNAPSHOT -&gt; [Help 1]
  </code></pre>
  
  <p>My question is, how can I include one project into other as its dependency? Please note that I'm not looking for a local dependency injection in maven since I want this to work in the future when I upload my packages into some repository.</p>