Search code examples
mavenjakarta-eepluginsglassfish

Maven plugins in WebApp and deploying


I'm using Maven in a JavaEE project. I splited my project into some modules : webapp (view+controler), business, persistence, model.

I'm asking :

--> Do I have to put my maven plugins glassfish into the pom.xml of the web app only or put it into the parent project pom.xml ? I don't understand properly how it works in this case because I have several moduls.

Also, how to deploy it ? I used mvn package glassfish:deploy But come with it the question about where do I have to make it : only in the webapp or in the parent project ?

Thanks for helping me


Solution

  • I would put the maven-glassfish-plugin only on the web app module. It doesn't make sense ( to me ) to configure that plugin in the parent module.

    Then I would package and deploy with two separate command:

    parentDir$ mvn clean package
    parentDir$ mvn -f webappDir glassfish:deploy
    

    or if you prefer:

    parentDir$ mvn clean package && mvn -f webappModuleDir glassfish:deploy