Skip to main content

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

Stock Eclipse JDT/WTP have no notion of test source folders. Any new source folder you manually add is added to the .settings/org.eclipse.wst.common.component file.

m2e-wtp updates the eclipse project configuration to match the maven settings when manually invoking "Maven > Update project". At that point it makes sure the maven test folders won't be deployed (i.e removes offending refs in org.eclipse.wst.common.component).

So yes, what you see is expected. 

We could probably react to the org.eclipse.wst.common.component modification, remove test folders on the fly, but ideally, we'd need m2e-wtp to hook into WTP to prevent those tests folders from being added to org.eclipse.wst.common.component in the first place, that's something to discuss with the WTP team.

Fred Bricon

On Fri, Nov 30, 2012 at 7:56 PM, Josh Beitelspacher <josh@xxxxxxxxxxxxx> wrote:
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



_______________________________________________
m2e-wtp-dev mailing list
m2e-wtp-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/m2e-wtp-dev




--
"Have you tried turning it off and on again" - The IT Crowd

Back to the top