MychaL
MychaL

Reputation: 999

How to deploy to Tomcat a multi maven module from Eclipse IDE?

I have a multi module Maven project with a common module which is a dependency of 2 others modules. One of this module generate a war which is integrated in the other one by overlay.

The final war is generated by Maven clean install command without problem. All the structure in target is OK. But if I install a Tomcat 8 server in servers view (with 'takes Tomcat control installation' mode) and deploy the project, it's a nightmare...

I have tests resources in WEB-INF/classes, the common module (jar) is not deployed in WEB-INF/lib, the war which should be integrated during the build by overlay appears in WEB-INF/lib.

Is there a way to have a clean deployment without adding a Tomcat plugin in Maven configuration ?

For information, it is Neon version. Deployment assembly are configured with src/main/* only (plus Maven dependencies).

We don't understand why Eclipse doesn't deploy the final application generated in target/xxx directory.

Upvotes: 1

Views: 2364

Answers (1)

MychaL
MychaL

Reputation: 999

Ok, I found the problem.

Eclipse doesn't care about Deployment Assembly. It mix Deployment Assembly AND Java Build Path.

When you import a maven project, the configuration of your project can be bad for an unknown reason. Check the sources folders declared in Java Build Path and check specialy the output directory of each source folder.

For src/test/resources, it set a default output (not target/test-classes). So all tests resources were copied into target/classes. And I don't know why he deployed to Tomcat this directory.

In Deployment Assembly, it just set these directories :

   - src/main/java -> WEB-INF/classes
   - src/main/webapp -> /
   - /target/m2e-wtp/web-resources -> /
   - Maven dependencies -> WEB-INF/lib
   - link to others modules

Now all work perfectly.

Upvotes: 1

Related Questions