Maciej Miklas
Maciej Miklas

Reputation: 3330

IntelliJ 12 - maven multimodule cannot resolve transitive dependencies

I've imported maven multimodule project and some transitive dependencies are not resolved. This same project builds in Jenkins/Eclipse/Console.

I've tried two import each project separately, and also to import only parent pom - both are not working.

I have following structure: Project A and Project B have common parent and both are defined as modules in this parent. Project A contains as dependency jackon-jar, Project B does not have it. Project A contains jackson-jar in default scope - jar is visible during compilation and tests are running. Now Project B imports Project A and also uses jackson-jar - and here is the problem - jackson-jar in not visible in Project B :( When I specify it explicitly in Project B all works fine, but it should come automatically as transitive dependency from Project A ......

Is this common problem? Is there workaround?

Here are POM examples:

Parent:

<project ....>
    <modelVersion>4.0.0</modelVersion>

    <version>1.0-SNAPSHOT</version>
    <groupId>miklas.test</groupId>
    <artifactId>my-parent</artifactId>
    <packaging>pom</packaging>

    <modules>
        <module>my-project-a</module>
        <module>my-project-b</module>
        <module>my-project-c</module>
    </modules>
</project>

Project-A

<project ....>
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>miklas.test</groupId>
        <artifactId>my-parent</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>

    <artifactId>my-project-a</artifactId>
    <packaging>jar</packaging>

    <dependencies>
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jackson-provider</artifactId>
            <version>2.3.4.Final</version>
        </dependency>
    </dependencies>

</project>

Project-B

<project >
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>miklas.test</groupId>
        <artifactId>my-parent</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>

    <artifactId>my-project-b</artifactId>
    <packaging>jar</packaging>

    <dependencies>
        <dependency>
            <groupId>miklas.test</groupId>
            <artifactId>my-project-a</artifactId>
            <version>${project.version}</version>
        </dependency>
    </dependencies>

</project>

Below is also the screenshot from my real project - this would be Project B from simplified example above. On the left side we can see, that resteasy-jackoson-provider has 4 dependent jars, and on the right side there are only two. Both views are showing the same project:

enter image description here

Now the same screenshot from Project A

enter image description here

Upvotes: 14

Views: 7196

Answers (2)

Stefan L
Stefan L

Reputation: 1541

Workaround mentioned at http://youtrack.jetbrains.com/issue/IDEA-98425 that worked for me and others is to go to "settings - Maven - Multiproject build fail policy". Set it to "Fail At End".

Upvotes: 1

Anonymoose
Anonymoose

Reputation: 5982

This appears to be a bug in IntelliJ 12. See http://youtrack.jetbrains.com/issue/IDEA-98425 and please vote for the issue if it's important to you.

Upvotes: 8

Related Questions