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 161205 - Profiles are not activated when running test file
Summary: Profiles are not activated when running test file
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Tomas Zezula
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-25 23:51 UTC by sgtgarcia
Modified: 2016-07-07 07:17 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Sample Maven project showing the problem (4.52 KB, application/x-gzip)
2009-03-28 11:04 UTC, sgtgarcia
Details
Snapshot of the Project view (31.07 KB, image/png)
2009-03-28 11:19 UTC, sgtgarcia
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sgtgarcia 2009-03-25 23:51:32 UTC
In a Maven 2 project having profiles xxx and yyy defined in its pom.xml
1) Right click on project > Properties
2) In configurations, select "Enable configurations" and activate configuration named "xxx (Profile)" 
3) In Actions, 
- in the "Configurations" drop down, select "xxx (Profile)"
- in the "Actions" list, select "Test File" 
- in the "Activate Profiles" , select "xxx"
4) Click on OK
5) Open a JUnit Test 
6) And run it (Ctrl+F6)
7) The test is launched but Maven profile was not activated
Comment 1 Milos Kleint 2009-03-26 08:23:10 UTC
in point 3. it's not necessary to enter the xxx profile name in the list of activated profiles. The active configuration
ensures the xxx profile is activated for all actions.

do you have the compile on save feature turned on for the project? is the test running executed via ant or maven? what
does the xxx profile contain? different surefire configuration, some properties?
Comment 2 sgtgarcia 2009-03-26 08:50:25 UTC
I left the "compile on save" default configuration, I don't even known where I can change this.

My profile contains the database configuration properties used for resource filtering.

When I do a "Clean and Build" , the profile is activated and everything works as expected: resources are copied and
filtered, code is compiled and tests ran. Despite that, then I run test file and it fails with an error showing that
resources haven't been filtered.
Comment 3 sgtgarcia 2009-03-26 08:50:55 UTC
I am using NetBeans 6.7M2
Comment 4 Milos Kleint 2009-03-26 09:04:03 UTC
a sample project would be useful. I think we have code that tried to identify resources with filtering and if such are
found, compile on save is not used. There could be a bug there.

Compile on save combo box is under Compile panel in project customizer
Comment 5 sgtgarcia 2009-03-26 09:55:30 UTC
IMHO: If I do full Maven build before running anything, everything is OK. 
1) NetBeans shouldn't try to compile by itself until I modify a source file. 
2) When I modify a file and save it,
- either NetBeans knows how to compile it (Java, not filtered Resources) -> CoS is useful
- or it doesn't (Filtered Resources) -> CoS is useless, a warning indicating that full build is required may appear.
Comment 6 Milos Kleint 2009-03-26 10:10:35 UTC
1. no idea what you talking about
2. shall be already happening. the logic for picking a CoS run or maven based run is there. I don't see a point in
poping up some dialog in user's face, noone is really interested.

As I said before a sample project demonstrating the problem would be useful.
Comment 7 sgtgarcia 2009-03-28 11:04:04 UTC
Created attachment 78999 [details]
Sample Maven project showing the problem
Comment 8 sgtgarcia 2009-03-28 11:06:15 UTC
Added sample project.
Read the readme.txt located in the tar.gz for information.
Thanks for your help.
Comment 9 sgtgarcia 2009-03-28 11:14:16 UTC
Some more information
- After a full Clean and Build there is a connection.properties file located in target/test-classes generated with
filtering
- As soon as I run a single test file this connection.properties file disappears
- Resource folder appear strangely in Projects view (see snapshot), is it related?
Comment 10 sgtgarcia 2009-03-28 11:19:40 UTC
Created attachment 79000 [details]
Snapshot of the Project view
Comment 11 sgtgarcia 2009-03-28 16:17:23 UTC
Manually disabling "Compile on Save" solves the issue
Comment 12 Milos Kleint 2009-04-06 06:59:10 UTC
reassigning to java, The JavaRunner code should not wipe out the output directory and if it has to delete something, it
should just delete the .class files.
Comment 13 bmaras 2010-03-17 17:56:32 UTC
Your symptoms looks like the one I reported in http://netbeans.org/bugzilla/show_bug.cgi?id=180006
Did you try with Netbeans configured to use an external Maven? I was suspecting a bug in the internal Maven of Netbeans, but I'm not sure at all.
Comment 14 ebesson 2010-03-29 07:34:33 UTC
I have the same bug on my computer.
When I have manually disabling "Compile on Save", the bug doesn't reappear.
Comment 15 David Strupl 2012-10-25 13:41:46 UTC
Bug prior to 7.0, not touched for the last 2 years --> P4.
Comment 16 Tomas Danek 2012-10-26 11:43:56 UTC
still reproducible, confirmed that CoS solves the issue (CoS if off by default since 7.3)
Comment 17 Martin Balin 2016-07-07 07:17:31 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss