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.
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
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?
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.
I am using NetBeans 6.7M2
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
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.
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.
Created attachment 78999 [details] Sample Maven project showing the problem
Added sample project. Read the readme.txt located in the tar.gz for information. Thanks for your help.
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?
Created attachment 79000 [details] Snapshot of the Project view
Manually disabling "Compile on Save" solves the issue
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.
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.
I have the same bug on my computer. When I have manually disabling "Compile on Save", the bug doesn't reappear.
Bug prior to 7.0, not touched for the last 2 years --> P4.
still reproducible, confirmed that CoS solves the issue (CoS if off by default since 7.3)
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