Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » maven-eclipse generated .projects not showing JUnit4 run configuration(Wondering, what do we need to change in our generated .project files to make JUnit menu-based testing work?)
maven-eclipse generated .projects not showing JUnit4 run configuration [message #895450] Thu, 12 July 2012 23:09 Go to next message
Eclipse UserFriend
We've been using 3.6 for a while and need to upgrade to 4.2.

We currently generate our .project files (and then import as an existing proj into Eclipse) using maven-eclipse, i.e. mvn eclipse:clean eclipse:eclipse. We do most of our build kickoffs via the command line, but we like to use the Run As type menu configs for debugging, running unit tests, etc.

I tried importing an existing project into Juno today and it acted like a Maven project. OK, that's kind of handy, being able to right click and do Maven -> install, test, etc.

But, I can't get the JUnit run configuration working to save my life. Any tips?
If I manually create a new unit test using the Eclipe menu, then that one test will work...but it's like it doesn't know it's a Java project or that it is using Junit.

This still works fine in 3.6

Here's a sample .project:

<projectDescription>
  <name>simplegis-core</name>
  <comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
  <projects/>
  <buildSpec>
    <buildCommand>
      <name>org.eclipse.jdt.core.javabuilder</name>
    </buildCommand>
  </buildSpec>
  <natures>
    <nature>org.eclipse.jdt.core.javanature</nature>
    <nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
  </natures>
</projectDescription>


(we do use groovy in some places for unit tests, but not on this project.

[Updated on: Thu, 12 July 2012 23:09] by Moderator

Re: maven-eclipse generated .projects not showing JUnit4 run configuration [message #895624 is a reply to message #895450] Fri, 13 July 2012 16:40 Go to previous messageGo to next message
Eclipse UserFriend
The .project looks OK, plain and easy.

Next thing to try: is your .classpath OK?

What exactly happens when you try to run a test?

best,
Stephan
Re: maven-eclipse generated .projects not showing JUnit4 run configuration [message #895674 is a reply to message #895624] Sat, 14 July 2012 12:17 Go to previous message
Eclipse UserFriend
Thanks - yeah, I didn't see too much difference between my .project and one that gets generated w/ a new project.

Well, that's sorta it - I can't seem to run the test via the Run configs.

Here is my .classpath:

<classpath>
  <classpathentry kind="src" path="src/test/java" output="target/test-classes" including="**/*.java"/>
  <classpathentry kind="src" path="src/test/resources" output="target/test-classes" excluding="**/*.java"/>
  <classpathentry kind="src" path="src/main/java" including="**/*.java"/>
  <classpathentry kind="output" path="target/classes"/>
  <classpathentry kind="var" path="M2_REPO/junit/junit/4.8.1/junit-4.8.1.jar"/>
  <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.16/log4j-1.2.16.jar"/>
  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
</classpath>


...and, well, this is embarrassing. I deleted my code, re-pulled from the repo, ran eclipse:clean and eclipse:eclipse...and it just works now.
When I originally did this, I started with the SpringSource Tool Suite and tried to "Import as a Maven Project" (just to kind of see what would happen). And I'm not sure I started w/ a clean workspace (eclipse:clean should have deleted my .project and .classpath files, though?).

Weird. Well, I'll take it. Thanks for the help - good reminder about checking .classpath.
Previous Topic:Debug does not synchronize
Next Topic:Copy Paste not working in Eclipse Juno
Goto Forum:
  


Current Time: Thu Nov 13 15:11:12 EST 2025

Powered by FUDForum. Page generated in 0.06745 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top