| Author |
Message |
|
|
Post subject: MyEclipse 7.0M2, maven packaging=war, JUnit don't execute
Posted: Oct 28, 2008 - 04:10 PM
|
|
Joined: Sep 25, 2008
Posts: 32
|
|
In MyEclipse 7.0M2 I'm getting JUnit/TestNG problems (running with the plugins), with the default maven build configuration and <packaging>war</packaging>.
Steps to recreate:
Start with clean pom (<packaging>jar</packaging>) with just JUnit /or TestNG dependencies and a simple test-class in src/test/java. Import as maven project.
Run mvn clean, then from MyEclipse menu select Project/Clean.
Run JUnit/TestNG class. [executes sucessfully and the test class are output to target/test-classes] [also executes with mvn clean test].
Remove project from MyEclipse. Delete all files in the project folder except /src and pom.xml, re-import maven project.
Run mvn clean, then from MyEclipse menu select Project/Clean.
Run JUnit/TestNG class which fails (ClassNotFoundException) and the test class are NOT output to target/test-classes (but still executes ok with mvn clean test). |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: MyEclipse 7.0M2, maven packaging=war, JUnit don
Posted: Oct 29, 2008 - 03:29 PM
|
|
Registered Member


Joined: Apr 18, 2007
Posts: 8013
|
|
allenparslow,
I have asked someone from the dev team to look into this issue. He will get back to you with an update asap. Thank you for your patience. |
_________________ Nipun
MyEclipse Support
|
| |
|
|
|
 |
|
|
Post subject: RE: MyEclipse 7.0M2, maven packaging=war, JUnit don
Posted: Nov 07, 2008 - 10:18 PM
|
|
Registered Member

Joined: May 12, 2005
Posts: 473
|
|
allenparslow,
I can't reproduce what you see. I did the following:
1. I created project using quickstart prototype.
2. I used m2eclipse "General/Maven Projects..." import wizard.
3. My workspace was set to Build Automatically but I tried removing that checkbox too. |
_________________ Eugene
MyEclipse Support
|
| |
|
|
|
 |
|
|
Post subject: RE: MyEclipse 7.0M2, maven packaging=war, JUnit don
Posted: Nov 09, 2008 - 01:54 PM
|
|
Joined: Sep 25, 2008
Posts: 32
|
|
Step #1: Create this project structure:
| Code: | JUnitTest
|-pom.xml
|-src
|-test
|-java
|-testing
|-SimpleJUnitTest.java
|-main
|-java
|-webapp
|-WEB-INF
|-web.xml |
pom.xml contents:
| Code: | <?xml version="1.0"?>
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>testing</groupId>
<artifactId>Test</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<repositories>
<repository>
<id>maven2</id>
<name>maven2</name>
<url>http://repo1.maven.org/maven2/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8</version>
</dependency>
</dependencies>
</project> |
SimpleJUnitTest.java contents:
| Code: | package testing;
import junit.framework.Assert;
import junit.framework.TestCase;
public class SimpleJUnitTest extends TestCase {
public void testTest() {
Assert.assertEquals(1, 1);
}
} |
Step #2: Enable importing of existing maven project
MyEclipse menu Window/Preferences/"MyEclipse Enterprise Workbench"/Maven4MyEclipse/"Enable all m2eclipse features"=true
Step #3: Import project with:
MyEclilpse menu File/Import.../Maven Projects/
Step #4: right click SimpleJUnitTest, choose run as...JUnit test |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: MyEclipse 7.0M2, maven packaging=war, JUnit don
Posted: Nov 09, 2008 - 02:26 PM
|
|
Joined: Sep 25, 2008
Posts: 32
|
|
If the class is put in src/main/java it runs just fine (it appears to be only test-cases in src/test/java). |
|
|
| |
|
|
|
 |
|
|