title: Java 9 with Maven - modules not found
body: <p>I'm working on the migration of our project from Java 8 to Java 9.</p>
  
  <p>Using: IntelliJ IDEA 2017.2.5</p>
  
  <p>Maven version: 3.5.1</p>
  
  <p>So far, I created <code>module-info.java</code> for all the modules I'd like to migrate. Here, <code>requires</code> works well with <code>java.base</code>. But all other external modules/dependencies do not, let's say for example log4j and packages from our project that are not yet migrated to Java 9. These packages are also added as dependencies in the POM. However, IntelliJ doesn't throw an error here.
  <a href="https://i.stack.imgur.com/WcRd9.png" rel="noreferrer"> Navigation from <code>module-info.java</code> to the corresponding JAR in <code>External Libraries</code> works.</a></p>
  
  <p>But as soon as I run the build with <code>clean install</code>, there is a compilation failure: <code>module not found: log4j</code>. Same with all other external packages.  </p>
  
  <p>Any idea why this error occurs? I thought non-modular dependencies will be turned into an automatic module by Java 9. What am I doing wrong or didn't understand the right way?</p>
  
  <p>Here is the project's POM:</p>
  
  <pre><code>&lt;groupId&gt;de.project&lt;/groupId&gt;
  &lt;artifactId&gt;basicProject&lt;/artifactId&gt;
  &lt;version&gt;1.0&lt;/version&gt;
  &lt;name&gt;Basic Project&lt;/name&gt;
  
  &lt;build&gt;
      &lt;pluginManagement&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;9&lt;/source&gt;
                      &lt;target&gt;9&lt;/target&gt;
                      &lt;compilerVersion&gt;3.7.0&lt;/compilerVersion&gt;
                  &lt;/configuration&gt;
                  &lt;version&gt;3.5.1&lt;/version&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-resources-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.0.1&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;copy-resources&lt;/id&gt;
                          &lt;!-- here the phase you need --&gt;
                          &lt;phase&gt;package&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;copy-resources&lt;/goal&gt;
                          &lt;/goals&gt;
                          &lt;configuration&gt;
                              &lt;outputDirectory&gt;../output/intern/&lt;/outputDirectory&gt;
                              &lt;resources&gt;
                                  &lt;resource&gt;
                                      &lt;directory&gt;intern&lt;/directory&gt;
                                      &lt;includes&gt;
                                          &lt;include&gt;loggingConfig.xml&lt;/include&gt;
                                      &lt;/includes&gt;
                                      &lt;!--&lt;filtering&gt;true&lt;/filtering&gt;--&gt;
                                  &lt;/resource&gt;
                              &lt;/resources&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/pluginManagement&gt;
  &lt;/build&gt;
  
  &lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;project.build.resourceEncoding&gt;UTF-8&lt;/project.build.resourceEncoding&gt;
  &lt;/properties&gt;
  
  &lt;repositories&gt;
      &lt;repository&gt;
          &lt;id&gt;some_repository&lt;/id&gt;
          &lt;name&gt;somerepos&lt;/name&gt;
          &lt;url&gt;http://some.rep.de/plugin/repo/everything&lt;/url&gt;
      &lt;/repository&gt;
  &lt;/repositories&gt;
  
  &lt;dependencies&gt;
      &lt;!--the first project --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;de.project&lt;/groupId&gt;
          &lt;artifactId&gt;firstProject&lt;/artifactId&gt;
          &lt;version&gt;1.2&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!--the second project --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;de.project&lt;/groupId&gt;
          &lt;artifactId&gt;secondProject&lt;/artifactId&gt;
          &lt;version&gt;1.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;de.project&lt;/groupId&gt;
          &lt;artifactId&gt;thirdProject&lt;/artifactId&gt;
          &lt;version&gt;1.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;de.project&lt;/groupId&gt;
          &lt;artifactId&gt;fourthProject&lt;/artifactId&gt;
          &lt;version&gt;1.4&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j&lt;/artifactId&gt;
          &lt;version&gt;1.2.17&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;com.someitextpdf&lt;/groupId&gt;
          &lt;artifactId&gt;someitextpdf&lt;/artifactId&gt;
          &lt;version&gt;5.5.12&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;io.github.lzf0349&lt;/groupId&gt;
          &lt;artifactId&gt;jdatepicker&lt;/artifactId&gt;
          &lt;version&gt;2.0.3&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;dom4j&lt;/groupId&gt;
          &lt;artifactId&gt;dom4j&lt;/artifactId&gt;
          &lt;version&gt;1.6.1&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!--libs for testing --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hamcrest&lt;/groupId&gt;
          &lt;artifactId&gt;hamcrest-all&lt;/artifactId&gt;
          &lt;version&gt;1.3&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;junit&lt;/groupId&gt;
          &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;version&gt;4.12&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.xml.bind&lt;/groupId&gt;
          &lt;artifactId&gt;jaxb-api&lt;/artifactId&gt;
          &lt;version&gt;2.3.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-annotations&lt;/artifactId&gt;
          &lt;version&gt;3.5.6-Final&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-envers&lt;/artifactId&gt;
          &lt;version&gt;5.2.1.Final&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p></p>
  
  <p>Project structure:</p>
  
  <ul>
  <li>Project SDK: 9.0 (java version "9.0.1")</li>
  <li>Project language level: 9 - Modules, private methods in interfaces etc. </li>
  <li>Module SDK: Project SDK (9.0)</li>
  <li>Modules --> Sources --> Language level: 9 - Modules, private methods in interfaces etc.</li>
  <li>Platform Settings: SDK: 9.0, JDK home path C:\Program Files\Java\jdk-9.0.1</li>
  </ul>