Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2e-wtp-dev] Test resources and classes copied to wtpwebapps

With Eclipse Juno SR1, WTP 3.4.1, m2e 1.2.0, and m2e-wtp 0.16.0.20120914-0945 I sometimes see my test resources and test classes being copied into the m2e-wtp deployment directory.

The files in src/main/resources appear to be taking precedence over the ones in src/test/resources. For example, if a log4j.properties file is in both locations then the one in src/main/resources will usually be used. However, in one case (which I can't reproduce) the log4j.properties from src/test/resources was used.

I would never have noticed this if not for the one time that the log4j.properties from src/test/resources was used instead of the log4j.properties from src/main/resources. I'm worried that if the wrong file got copied once it could happen again. I'd much prefer if the test resources were not used at all.

It also appears that performing a Maven "Update Project Configuration" fixes the issue, at least temporarily.

Steps to reproduce:

1.) Inside Eclipse generate a new Maven WAR project using the maven-archetype-webapp.
2.) Add a src/test/resources folder.
3.) Run a Maven "Update Project Configuration" so that the src/test/resources folder will be added to the classpath.
4.) Add the webapp to a Tomcat 7 server and start the server.
5.) Verify that the wtpwebapps/[webapp-name]/WEB-INF/classes directory is empty.
6.) Add a file to src/test/resources.
7.) Verity that the new file shows up in wtpwebapps/[webapp-name]/WEB-INF/classes.

At this point all files in src/test/resources will be copied to the webapp deployment. If you run another "Update Project Configuration" now, all the files from src/test/resources will be deleted from wtpwebapps and no new files will be copied.

Is this a known issue? Should projects generally be OK as long as source or resource folders aren't modified?

Thanks,
Josh



Back to the top