This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes IDEs, Version Control and other tools and the fly likes Test files deploying to Tomcat in Eclipse, how do you stop Eclipse from doing this Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Test files deploying to Tomcat in Eclipse, how do you stop Eclipse from doing this" Watch "Test files deploying to Tomcat in Eclipse, how do you stop Eclipse from doing this" New topic
Author

Test files deploying to Tomcat in Eclipse, how do you stop Eclipse from doing this

Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

So we have a properties file that is in the src and the test resource directories. When we deploy the app to Tomcat running in Eclipse, it takes the test resource files, which is incorrect. Test needs to be a source directory so we can run the tests, but the tests obviously don't run in Tomcat.

Besides using "excludes" in the source, how can you get Eclipse not to deploy the test classes and resource files onto the Tomcat running in Eclipse.

Thanks

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15950
    
  19

You should have 2 separate source directories - one for the app and one for the tests. If you want to use Maven's standards, they'd be src/main/java and src/test/java.

Normally Eclipse compiles all classes to a single output directory (by default, it's "bin"). However, you can designate individual output directories on a per-source-directroy basis. That will keep the unit test classes out of the WAR.


Customer surveys are for companies who didn't pay proper attention to begin with.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Tim Holloway wrote:You should have 2 separate source directories - one for the app and one for the tests. If you want to use Maven's standards, they'd be src/main/java and src/test/java.

Normally Eclipse compiles all classes to a single output directory (by default, it's "bin"). However, you can designate individual output directories on a per-source-directroy basis. That will keep the unit test classes out of the WAR.


Thanks everything is already configured that way. But for some reason, it still is taking files from the resource directory for tests and putting into the deployment on Tomcat. Tomcat is being run inside Eclipse, so it is all in a tmp0 directory that Eclipse is making and copying files into that directory.

Mark
Brian Mulholland
Ranch Hand

Joined: Mar 12, 2009
Posts: 61
Bump. I am having a very similar issue. How did you resolve this?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Test files deploying to Tomcat in Eclipse, how do you stop Eclipse from doing this
 
Similar Threads
How to run cactus test in one step ?
Is there succint Eclipse setup HOWTO for compiling java?
Tomcat 6, Eclipse and 404 errors oh my!
Stop/Start Tomcat within eclipse
Not able to display starting jsp page index.jsp