Deploying a War File to Tomcat Root With Maven pom.xml

前端 未结 3 630
没有蜡笔的小新
没有蜡笔的小新 2021-01-15 15:03

Assuming the following pom.xml maven would build a client.war file which when deployed to Tomcat will have the URL www.server.com:8080/client

3条回答
  •  不知归路
    2021-01-15 15:28

    Maven war plugin (which is defined on super-pom by default) will only generate a war file. It's up to you to set up your app on Tomcat. If you want to add the "deploy to a container" to your maven build, go with Tomcat Maven Plugin or Cargo Maven Plugin.

    What you want has nothing to do with Maven, actually. Setting your war name to ROOT.war should do it (ROOT on your build section), but if you want to add your context.xml to the war file, you could do something like (assuming src/main/webapp is your webapp folder defined by maven):

    `
    org.apache.maven.plugins
    
    maven-war-plugin  
              
                
                  
                  ${basedir}/src/main/webapp/META-INF  
                    
                    context.xml  
                    
                  META-INF  
                  true  
                  
                
              
            
    

    `

提交回复
热议问题