Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent eclipse from deploying test classes on Tomcat?

I have a Maven project, containing the typical folders src/main/java and src/test/java and I am using Eclipse 3.7 with m2e 1.0.and Maven Integration for WTP 1.4.0 . Eclipse is used during development to deploy the application on an server (Tomcat or Glassfish), but it deploys the test classes from src/test/java folder too.

I do not want the test classes deployed, so how can I "exclude" that directory from eclipse-tomcat deployment?

like image 359
Ralph Avatar asked Mar 22 '12 08:03

Ralph


People also ask

How do I change Tomcat deploy path in eclipse?

Follow the steps below to change the default deploy directory of Tomcat in Eclipse. Select “use custom location” radio button in the “Server Locations” section and set your custom deploy path.

How do I know if Tomcat is running in Eclipse?

Go to the project in the Project Explorer, select the web project, right click and select "Run As", you will see Apache Tomcat, create runtime configuration for the web project by selecting "New" button.

What should be deploy path for Tomcat?

Another thing we can do is to deploy it by simply dropping it into the $CATALINA_HOME\webapps directory of any Tomcat instance. If the instance is running, the deployment will start instantly as Tomcat unpacks the archive and configures its context path.


1 Answers

It is configurable in Eclipse how to handle and deploy the different folders, somehow the Eclipse plugin M2Eclipse should configure Eclipse right, it seams that the configuration sometimes is done and sometimes not.

So one has to check this two settings:

  • Project Properties\Java Build Path(Tab)Source : Outputfolder for <PROJECT>/src/test/java as well as <PROJECT>/src/test/resources must be <PROJECT>/target/test-classes

  • Project Properties\Deployment Assembly : There must be NO entry for <PROJECT>/src/test/java or <PROJECT>/target/test-classesenter image description here

like image 120
Ralph Avatar answered Sep 20 '22 10:09

Ralph