14

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

Maciej Miklas
  • 3,305
  • 4
  • 27
  • 52

2 Answers2

8

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.

Anonymoose
  • 5,662
  • 4
  • 33
  • 41
  • 2
    This is serious problem which prevents me from using intellij in general - they should fix such things ASAP without any voting.... but well I will vote ;) – Maciej Miklas Jan 08 '13 at 06:40
1

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".

Stefan L
  • 1,529
  • 13
  • 20
  • 2
    in my case (and some others) it did not help – Maciej Miklas Jan 14 '13 at 14:26
  • I had it fail again afterwards too :( After some lengthy "voodoo" practices (not sure what the useful part is yet) of toggling the "use maven 3 for import", "Maven projects tool window - reimport all maven projects", "mvn install" from the command line, reopening the project, synchronizing the project, "settings - maven - repository - select local - update", invalidating caches, "rebuild project" it randomly works again. – Stefan L Jan 15 '13 at 11:11
  • yeah.... I've tried similar approach. After a while my project was able to compile, and I was unable to break it again... even by removing mandatory dependencies.... what a crap... – Maciej Miklas Jan 15 '13 at 12:44
  • Supposed to be fixed in 12.0.3. 12.0.2 was just released yesterday. – Stefan L Jan 16 '13 at 09:15
  • Fixed in IntelliJ IDEA 12 EAP http://confluence.jetbrains.net/display/IDEADEV/IDEA+12+EAP release 123.50 http://confluence.jetbrains.net/display/IDEADEV/Leda+123.150+Release+Notes – Stefan L Jan 29 '13 at 08:24