开发者

How to specify the order of modules for Maven?

Project structure is:

/foo
  pom.xml
  /foo-war
    pom.xml
  /foo-ear
    pom.xml

This is my parent pom.xml:

.. foo-war

foo-ear ..

This is the content of foo-ear/pom.xml:

.. ${project.groupId} foo-war war 开发者_C百科${project.version} ..

Compilation fails with this message:

...
[INFO] Failed to resolve artifact.
Missing:
—————
1) com.foo:foo-war:war:1.0-SNAPSHOT
Try downloading the file manually from the project website.
...

Looks like foo-ear is trying to resolve the artifact when it's not ready yet. How can I instruct maven to work with foo-war beforehand? Or I'm missing something?

ps. Everything is fixed when I remove this code from parent pom.xml:

<build>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>${javadoc.version}</version>
        <executions>
            <execution>
                <phase>compile</phase>
                <goals>
                   <goal>aggregate</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
</build>

Why?


Everything is fixed when I remove this code from parent pom.xml (...)

The problem looks similar to MJAVADOC-161 and more generally MJAVADOC-137. Could you be using a buggy version of the maven-javadoc-plugin like 2.3 (sadly, you're not showing it)? If yes, try with version 2.4 or another more recent version. And if you are using a version greater than 2.4, try with the version 2.4 to see if a regression was introduced at some point. And in this case, please open a new issue.


I'm using version 2.5. When I'm trying to reverse back to 2.4 I'm getting: 'aggregate' was specified in an execution, but not found in the plugin. Looks like 2.5 is my only option? You think I need to file a bug report?

I didn't pay attention to the goal, javadoc:aggregate has been introduced in version 2.5 so it won't be in 2.4 indeed and the issues mentioned above aren't relevant.

But I took a second look and I saw some others like MJAVADOC-275 or MJAVADOC-276. I'm not sure to understand the exact status (and the bug might be not fixed) but before opening an issue, be sure to try with versions 2.7 and version 2.6 (some people mention a regression introduced in 2.6.1).


Maven automatically resolves dependencies between modules and builds them in the correct order (At least if you are using a fairly current version), but only if you build from the parent project. (The Maven component in charge of this is called the Reactor).

If this does not work, then probably the module is not identical to the referenced dependency (e.g. the versions don't match).

Please compare <groupId>, <artifactId>, <version>, <packaging>/<type> of

a) the dependency block in the ear and

b) the pom header of the war


It looks as though are setup correctly above. It doesn't look like a build order issue.

When you run from your top level, Maven will output the reactor build order, e.g:

[INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO]   foo-ear
[INFO]   foo-war

Does this look OK?

Are you also definetly building 1.0-SNAPSHOT in your WAR pom? What happens if you navigate to foo-war and 'mvn install' that and then attempt to build from the top level?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜