开发者

maven eclipse:eclipse target generates bad .classpath

I have a maven parent project P with two child modules A and B. Both A and B are inside the P folder. P has a modules section in the pom.xml resembling:

<modules>
  <module>A</module>
  <module>B</module>
</modules>

A has (and B the same except the artifac开发者_JAVA百科t):

<parent>
  <groupId>some.group</groupId>
  <artifactId>A</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <relativePath>../pom.xml</relativePath>
</parent>

Now I made A depend on B by adding to A's pom.xml:

<dependencies>
  <dependency>
    <groupId>some.group</groupId>
    <artifactId>B</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <type>jar</type>
    <scope>compile</scope>
  </dependency>
</dependencies>

If I do a mvn install on P, then all is fine. However after running mvn eclipse:eclipse on P, the generated .classpath file in A is incorrect, and Eclipse can't resolve the dependencies from B.

The generated .classpath includes:

<classpathentry kind="src" path="/B"/>

instead of the working

<classpathentry kind="var" path="M2_REPO/some/group/B/0.0.1-SNAPSHOT/B-0.0.1-SNAPSHOT.jar"/>

What could be wrong? Thank you.


If you set the property useProjectReferences to false (with -DuseProjectReferences=false), then it should work like you want (default is true). See the docs here

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜