ktgirish
ktgirish

Reputation: 257

Deployment Assembly configuration not working with mvn package

Below is the maven project structure I have in eclipse:

enter image description here

And the deployment assembly configuration is as shown below:

enter image description here

If I package the war with maven command (mvn clean package) and deploy the war on tomcat, the "resource" folder under WEB-INF is not getting created as I mentioned in deployment assembly configuration. The server side folder structure created after deployment is as in the image below:

enter image description here

But, if I export the war from eclipse "Right click on project -> Export -> War file" and deploy in tomcat, it is creating the "resources" folder.

enter image description here

Kindly help me with this. Thanks in advance!!!

Upvotes: 0

Views: 380

Answers (1)

Nick Wilson
Nick Wilson

Reputation: 4989

If you look at the documentation for the maven-war-plugin here:

maven-war-plugin

You'll see that by default the contents of the "resources" folder gets placed inside the "classes" folder inside the WAR, so for a maven build you should find your resources in there.

Your Eclipse configuration is different, placing the resources in a separate "resources" folder under WEB-INF. Exporting from Eclipse will use this configuration rather than the maven configuration.

I would recommend changing your Eclipse configuration to match the maven one by changing the Deploy Path to "WEB-INF/classes"

Upvotes: 1

Related Questions