Project M2Eclipse & workspace

In Eclipse Helios, the m2eclipse plugin does not include projects in my local workspace in any startup configuration.

I installed this test case:

ProjectA
+ src/main/java/a/TestInA.java
+ pom.xml

ProjectB
+ src/main/java/b/TestInB.java ("main()" calls "a.TestInA.main()")
+ pom.xml (includes reference to ProjectA)

In both projects, the “Allow dependencies on workspace projects” flag is set. This works great when compiling, i.e. The compiler finds a link to "a.TestInA" in "b.TestInB", and the list of "Maven dependencies" contains a link to "ProjectA". But when I try to run "b.TestInB", I get a NoClassDefFoundError:

Exception in thread "main" java.lang.NoClassDefFoundError: a/TestInA
at b.TestInB.main(TestInB.java:13)
Caused by: java.lang.ClassNotFoundException: a.TestInA
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 1 more

In fact, the system property "java.class.path" does not include the folder "target / classes" ProjectA (or any other folder, for that matter).

These are my installed versions:

  • Eclipse: Helios Service Release 2 ( : 20110301-1815)
  • m2eclipse: 0.12.1 ( : 20110112-1712)
+3
2

, . "archiverClassifier" . POM - .

"jdk1.5" "jdk1.6", "archiverClassifier" :

<profiles>
    <profile>
        <id>jdk1.5</id>
        <activation>
            <jdk>1.5</jdk>
        </activation>
        <properties>
            <compilerTarget>1.5</compilerTarget>
            <archiverClassifier>jdk1.5</archiverClassifier>
        </properties>
    </profile>
    <profile>
        <id>jdk1.6</id>
        <activation>
            <jdk>1.6</jdk>
        </activation>
        <properties>
            <compilerTarget>1.6</compilerTarget>
            <archiverClassifier>jdk1.6</archiverClassifier>
        </properties>
    </profile>
</profiles>

, , , "", "archiverClassifier" , :

<dependencies>
    <dependency>
        <groupId>com.brain2</groupId>
        <artifactId>ProjectA</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <classifier>${archiverClassifier}</classifier>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
</dependencies>

"", m2eclipse .

, Google " m2eclipse" JARA Sonatype MNGECLIPSE-680. , , :)

( , " " .)

+3

, Maven JAR. (mvn install) A, B ( A) . IDE .

0

All Articles