This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 214236 - Running Test or Test all from the below the editor buttons is not equal to Test from project
Summary: Running Test or Test all from the below the editor buttons is not equal to Te...
Status: NEW
Alias: None
Product: contrib
Classification: Unclassified
Component: Codecoverage (show other bugs)
Version: 7.2
Hardware: PC Windows 7
: P2 normal with 1 vote (vote)
Assignee: Martin Schovanek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-14 20:22 UTC by javydreamercsw
Modified: 2012-07-11 15:43 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Image for the "below editor" section referenced (138.35 KB, image/png)
2012-06-15 13:02 UTC, javydreamercsw
Details

Note You need to log in before you can comment on or make changes to this bug.
Description javydreamercsw 2012-06-14 20:22:58 UTC
Product Version = NetBeans IDE Dev (Build 201206140001)
Operating System = Windows 7 version 6.1 running on x86
Java; VM; Vendor = 1.7.0_04
Runtime = Java HotSpot(TM) Client VM 23.0-b21

This is a Maven project for which I modified the Test action. Basically I have a property skipTest set to true by default so on the Cutom action I set it to false so tests are ran. If I try from the buttons below the editor (when Cobertura is used) it uses the default test goal (ignoring my settings)
Comment 1 Milos Kleint 2012-06-15 06:39:08 UTC
a sample project is essential here and also a screenshot of the "below editor"
Comment 2 javydreamercsw 2012-06-15 13:02:55 UTC
Created attachment 120907 [details]
Image for the "below editor" section referenced

It is an open source project you can retrieve from here: https://xinco.svn.sourceforge.net/svnroot/xinco/trunk
Comment 3 Milos Kleint 2012-06-18 08:03:52 UTC
"Test All" in the coverage view, will invoke special "jacoco" or "cobertura" action mappings that by default include skiptests=false. However for some reason, the "Test" action will fallback to the default test file mapping which is not safe to call, there appears to be no way to customize that from maven's implementation of CoverageProvider.
Comment 4 Milos Kleint 2012-06-19 09:44:56 UTC

I haven't tested the hypothesis but I believe "Test" action could work with jacoco  code coverage, because that one injects a jvm agent at the beginning of the build and that way modifies the argLine parameter of the surefire plugin. Meaning all executions of surefire plugin will get the instrumentation needed for code coverage.

however cobertura works in a different way, it  has it's own maven goal to execute the code coverage collection and test execution. So the infrastructure needs to ask for this, and/or allow to disable the action. On first look I haven't noticed a way to run the code coverage report just for one file only.
Comment 5 jmborer 2012-07-11 15:43:41 UTC
I am able to reproduce it with several simple steps:

1) Make sure you use the bundle Maven 3.0.4
2) Create a new Maven->Java Application Project
3) Create a JFrame form (NewJFrame) in the project

DO NOT BUILD HERE

4) Right click on the Frame and select "Run file"
5) you get 

cd C:\Documents and Settings\borerjc.SKYGUIDE\My Documents\NetBeansProjects\mavenproject1; "JAVA_HOME=C:\\Program Files\\java\\jdk1.6.0_30" "\"C:\\Program Files\\netbeans\\7.2fcs\\java\\maven\\bin\\mvn.bat\"" "-Dexec.args=-classpath %classpath com.mycompany.mavenproject1.NewJFrame,com.mycompany.mavenproject1.NewJFrame" "-Dexec.executable=C:\\Program Files\\java\\jdk1.6.0_30\\bin\\java.exe" -Dexec.classpathScope=runtime process-classes org.codehaus.mojo:exec-maven-plugin:1.2:exec
Scanning for projects...
                                                                        
------------------------------------------------------------------------
Building mavenproject1 1.0-SNAPSHOT
------------------------------------------------------------------------

[resources:resources]
[debug] execute contextualize
Using 'UTF-8' encoding to copy filtered resources.
skip non existing resourceDirectory C:\Documents and Settings\borerjc.SKYGUIDE\My Documents\NetBeansProjects\mavenproject1\src\main\resources

[compiler:compile]
Compiling 2 source files to C:\Documents and Settings\borerjc.SKYGUIDE\My Documents\NetBeansProjects\mavenproject1\target\classes

[exec:exec]
java.lang.NoClassDefFoundError: com/mycompany/mavenproject1/NewJFrame,com/mycompany/mavenproject1/NewJFrame
Caused by: java.lang.ClassNotFoundException: com.mycompany.mavenproject1.NewJFrame,com.mycompany.mavenproject1.NewJFrame
	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:306)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: com.mycompany.mavenproject1.NewJFrame,com.mycompany.mavenproject1.NewJFrame.  Program will exit.
Exception in thread "main" [INFO] ------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 1.594s
Finished at: Wed Jul 11 15:40:06 GMT 2012
Final Memory: 6M/15M
------------------------------------------------------------------------
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2:exec (default-cli) on project mavenproject1: Command execution failed. Process exited with an error: 1(Exit value: 1) -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Check Maven network proxy...



If you build first then "Run file" will work, but then you can reproduce it again by making "clean" and then again select "Run file" on NewJFrame.

For some reason, every time I try to run a file after a build in my projects, they get rebuilt anyway.