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 168041 - Maven issues in 6.7 that were not present in 6.5 (run test class, system properties)
Summary: Maven issues in 6.7 that were not present in 6.5 (run test class, system prop...
Status: RESOLVED DUPLICATE of bug 168036
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: Milos Kleint
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-02 14:51 UTC by ebiel
Modified: 2009-07-03 13:11 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ebiel 2009-07-02 14:51:06 UTC
Product Version: NetBeans IDE 6.7 (Build 200906241340)
Java: 1.6.0_14; Java HotSpot(TM) Client VM 14.0-b16
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
Userdir: C:\Documents and Settings\Uli\.netbeans\6.7
---
Apache Maven 2.1.0 (r755702; 2009-03-18 20:10:27+0100)
Java version: 1.6.0_14
Java home: C:\Program Files\Java\jdk1.6.0_14\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"
---
I have two issues with the Netbeans 6.7 maven support that were not present in Netbeans 6.5:

1) If I run a test class (test class is open in editor, choosing Run-Run File from menu) in Netbeans 6.7 the following
is executed:
NetBeans: Executing '"C:\Program Files\apache-maven-2.1.0\bin\mvn.bat" -Dmaven.test.skip=true -Dexec.classpathScope=test
-Dexec.args=-classpath %classpath org.xxx.xxx.xx.xxxxx.ArticleXMLTest -Dexec.executable=C:\Program
Files\Java\jdk1.6.0_14\bin\java.exe -Dnetbeans.execution=true --errors --errors --fail-fast process-classes
org.codehaus.mojo:exec-maven-plugin:1.1.1:exec'
In Netbeans 6.5 the following was executed:
NetBeans: Executing 'C:\Program Files\apache-maven-2.1.0\bin\mvn.bat -Dtest=ArticleXMLTest --errors test-compile
surefire:test'
I am not quite sure if this has anything to do with the second issue (see below) but it doesn't seem right to my to
launch a test class calling the exec plugin instead of the surefire plugin.

2) The more serious issue is that I have defined a lot of system properties in the pom, more specifically in the context
of the exec-maven-plugin and the maven-surefire-plugin that are required to run my classes (database connection etc.):

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <configuration>
    <redirectTestOutputToFile>true</redirectTestOutputToFile>
    <argLine>-Xmx1024m -Xms128m</argLine>
    <includes>
      <include>**/*Test.java</include>
    </includes>
    <forkMode>always</forkMode>
    <systemProperties>
      <property>
        <name>testproperty</name>
        <value>testvalue</value>
      </property>
    </systemProperties>
  </configuration>
</plugin>

However, if I run a class from the source or the test tree I cannot access these properties. The following returns
'null' if executed in Netbeans 6.7:

String value = System.getProperty(key);

This works in Netbeans 6.5 and when calling maven from the command line.
Comment 1 Milos Kleint 2009-07-03 08:07:50 UTC
1. In 6.7 you should use the "Test file" action for testing, rather than "Run file" (which executes main class), the
Test file action is missing in editor's popup (issue 167267).

2. Is the test executed via the quick runner/compile on save? you would notice by having non-maven output in the output
window when running the test. If so, can you try turning Compile on Save off (in project properties window) and retry?

Comment 2 ebiel 2009-07-03 11:13:16 UTC
Okay, compile on save option definitely plays a role here, at least for test classes (see point 3):

1. Compile on save: test execution only
I run the test class using 'Test File' and for about one minute (!) nothing at all happens. Then, the Test Results
window pops up and the test is executed. System properties defined in the pom.xml as described in the description do not
work.

2. Compile on save: disabled
I run the test class using 'Test File', the Test Results window immediately pops up and the test is executed. System
properties defined in the pom.xml do work.

3. Compile on save: disabled
I run a class with a main method (no test class, lives in source tree not in the test tree of the project) using 'Run
File'. System properties defined in the pom.xml do not work.

Thanks for the quick reply!
Comment 3 Milos Kleint 2009-07-03 13:11:44 UTC
re 1. the long delay probably means the build/run was executing in the output window that was hidden.
the issue described here is a duplicate of #168036. 

re 3. probably a problem in exec-maven-plugin, or your configuration of the plugin. Not really netbeans related it seems.

closing as duplicate of #168036.

*** This issue has been marked as a duplicate of 168036 ***