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 168036

Summary: run or debug JUnit class does not use the specified Maven profiles
Product: projects Reporter: ccronemberger <ccronemberger>
Component: MavenAssignee: Milos Kleint <mkleint>
Status: VERIFIED FIXED    
Severity: blocker CC: blaha, sustaining
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description ccronemberger 2009-07-02 14:32:19 UTC
My JUnit classes can work in two ways and the selected way is defined by specifying a profile or not.
I open the project "properties" page, select "Actions", select the "Test file" action and add a profile, but when I run
the test from menu "Run->Test file (ctrl-f6)" I see in the generated log that the profile is not really active.
Comment 1 ccronemberger 2009-07-02 14:36:35 UTC
I also found that the following plug-in configuration is not being taken into account:

            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <!-- redirect log output to files in target/surefire-reports -->
                    <redirectTestOutputToFile>true</redirectTestOutputToFile>
                    <systemProperties>
                        <property>
                            <name>my.property.name</name>
                            <value>blablabla</value>
                        </property>
                    </systemProperties>
                </configuration>
            </plugin>

In the test code I found that the system property "my.property.name" is not set.
Comment 2 Milos Kleint 2009-07-03 13:08:42 UTC
first we've done the system properties configuration parsing wrong. And then we've also started caching some models
(weak referencing them) which caused the profiles not to show as activated.

http://hg.netbeans.org/main/rev/87231505d3b5
http://hg.netbeans.org/main/rev/2c8225d219e3

these 2 changeset shall fix both. Please verify in the upcoming dev builds (the exact number will be added to the
issue), we might be able to backport this to 6.7..
Comment 3 Milos Kleint 2009-07-03 13:11:33 UTC
*** Issue 168041 has been marked as a duplicate of this issue. ***
Comment 4 Quality Engineering 2009-07-04 06:27:21 UTC
Integrated into 'main-golden', will be available in build *200907040200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/87231505d3b5
User: Milos Kleint <mkleint@netbeans.org>
Log: #168036 when retrieving properties in plugin configuration consider this pattern <property><key>foo</key><value>bar</bar></property
additionally use a new instance of embedder for use in RunConfig to prevent retrieving a cached instance that might have different profiles activated.
Comment 5 Petr Blaha 2009-07-07 11:20:34 UTC
Reporter, would you verify the fix in the latest trunk build that is available here:
http://bits.netbeans.org/dev/nightly/latest/? We will put the fix in patch1 for Nb 6.7. Thanks
Comment 6 Jaroslav Pospisil 2009-07-09 08:54:23 UTC
v.
Comment 7 pgebauer 2009-07-09 16:46:22 UTC
The fix has been ported into the release67_fixes repository.
http://hg.netbeans.org/release67_fixes/rev/49002777df2c