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
intellij-idea maven


source to share


No one has answered this question yet

Check out similar questions:

768
What is Maven Snapshot and why do we need it?
670
How do I tell Maven to use the latest dependency?
663
Differences Between Dependencies and Management in Maven
539
IntelliJ: never use wildcard imports
478
IntelliJ Inspection gives "Cannot resolve symbol" but still compiles the code
382
IntelliJ - convert Java project / module to Maven project / module
265
Force Intellij IDEA re-read all maven dependencies
176
Import Maven dependencies into IntelliJ IDEA
five
How to create imported maven project in Intellij IDEA 11?
1
Cannot use external dependencies (Maven installed) in IntelliJ Ultimate



All Articles
Loading...
X
Show
Funny
Dev
Pics