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 242093 - Running 'Test File' (or any fucused test) does not update resource files in classpath, with maven.
Summary: Running 'Test File' (or any fucused test) does not update resource files in c...
Status: RESOLVED WONTFIX
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 8.0
Hardware: PC Mac OS X
: P3 normal (vote)
Assignee: Tomas Stupka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-19 13:37 UTC by ender01
Modified: 2016-07-07 08:38 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 ender01 2014-02-19 13:37:29 UTC
Use case is a JUnit test(in a Maven project) combined with Liquibase change logs that need are being modified and tested. If I update a file in src/main/resources and run a test, the resources are not updated in the target folder. 

In order for the tests to work I have to first run a build (which copies the resources), and then run the test. Seems like when you run a test, along with compiling everything, the resources should be updated as well as tests could depend on them.

I have not tested if the resources in src/test/resources are updated or not, but my current use is the resources are part of the main classpath.
Comment 1 Theofanis Oikonomou 2014-02-19 14:10:50 UTC
I am not really familiar with liquibase but this is what I did:
created default j2se maven project
added resources under src/main
created src/main/resources/newpackage/dummy.properties file
added name=John in that file
created src/main/java/test/mavenproject1/NewClass.java
created a junit 4 test for that class
run Test on the project
dummy.properties is copied to target/classes/newpackage with content name=John
modified src/main/resources/newpackage/dummy.properties to contain name=John.John
saved the file
checked again dummy.properties in target/classes/newpackage and the content was name=John.John

am I following what you are describing?
Comment 2 ender01 2014-02-19 17:59:06 UTC
I am not seeing that behavior with any of my maven projects. When I save the files under src/main/resources, or when I run a test, the files in 'target/classes' are not updated. I have to explicitly run a build for the files in target to updated.

Just confirmed this with both XML files (liquibase) that are not processed (property substitution through maven) and with a properties file that does have property replacement, neither were updated.


However, it does copy the files if I do a clean, and then just run 'test file' on my unit test. Something somewhere knows the files are not present and runs the needed goals, but it does not know if the files are out of date. 

Thinking this may be related to the Compile on Save feature.
Comment 3 Theofanis Oikonomou 2014-02-20 09:15:05 UTC
In that case I am re-assigning as I am not familiar with the specifics of CoS in maven. Thank you
Comment 4 Milos Kleint 2014-02-20 09:25:50 UTC
ender01: can you provide a sample project demonstrating the problem? 

are your resources filtered? We do not copy filtered resources, only resources in non-filtered roots
Comment 5 ender01 2014-02-20 13:12:54 UTC
They are filtered. Is there anyway that this could be added as a feature? I would expect this could lead to some unexpected behavior for folks who think their resources are updated, but are in fact not. And with the only way to really tell is to check the target directory manually, this is not really the best work flow.

I suppose a workaround would be to setup a specific <resource> tag for a subset of the resources, but it is not indicated in any of the CoS documentation that this is needed. This would only be added to work around an issue with Netbeans, and I highly dislike IDE specific items to a project build. (which is one of the main reasons I use netbeans to begin with)
Comment 6 Milos Kleint 2014-02-21 07:21:44 UTC
it's described in documentation here - http://wiki.netbeans.org/FaqCompileOnSave#Using_Compile_on_Save_in_Maven_Projects

your only workaround is to put all files that do require filtering into a separate resource root.
Comment 7 Martin Balin 2016-07-07 08:38:54 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