IntelliJ - Why is the import independent of the Maven module?

I have an IntelliJ project 'myapp' which includes, via pom.xml, a module called 'common'. A common module is for hosting utility classes and common dependencies like logging.

Here is the pom.xml for my application:

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>test</groupId>
  <artifactId>myapp</artifactId>
  <packaging>pom</packaging>
  <modules>
    <module>../common</module>
  </modules>
</project>

      

Here is the pom.xml for the generic module:

<project>

  … other stuff

  <dependencies>
    <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
      <version>1.1.1</version>
      <scope>compile</scope>
    </dependency>

    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.2.12</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>
</project>

      

So I would expect you to be able to use community logging in myapp code without further steps. However, this doesn't work. Even if I manually add (and export) the shared module as a dependency in myapp and mark the shared and log4j accounts as exported together, it still doesn't work.

Obviously I can add the registration dependencies directly to myapp pom.xml, but I was hoping for a modular way to do it. I am using IntelliJ 14.1.3 Ultimate.

Any help would be greatly appreciated.

BTW: I tried to include some screenshots in this post, but apparently I don't have at least a "10" reputation;)

+3


source to share





All Articles