How to use maven plugin tomcat7:run with multiple contexts (WARs)?

后端 未结 2 627
攒了一身酷
攒了一身酷 2020-12-28 16:27

I\'ve been using mvn tomcat7-maven-plugin:run -am -pl :foo successfully to run just a single project at a time in Tomcat like is shown here. Now I\'d like to ha

相关标签:
2条回答
  • 2020-12-28 17:00

    As it was already suggested, use <webapps> section of plugin configuration, but add additional parameter <asWebapp>true</asWebapp> for every webapp, i.e:

    <webapps> 
      <webapp> 
        <groupId>com.company</groupId> 
        <artifactId>mywebapp</artifactId> 
        <version>1.0</version> 
        <type>war</type>    
        <asWebapp>true</asWebapp> 
      </webapp> 
      <webapp> 
        <groupId>com.company</groupId> 
        <artifactId>mywebapp2</artifactId> 
        <version>2.0</version> 
        <type>war</type>    
        <asWebapp>true</asWebapp> 
      </webapp>
    </webapps> 
    

    These additional webapps are deployed with ${artifactId} context path by default.

    It looks like without this parameter additional webapps get silently discarded when you run something like mvn tomcat7:run (tried on stable version 2.0). Related Jira issue tells it was done for "backward compatibility".

    0 讨论(0)
  • 2020-12-28 17:24

    Use something like

      <configuration>
        <webapps> 
          <webapp> 
            <groupId>com.company</groupId> 
            <artifactId>mywebapp</artifactId> 
            <version>1.0</version> 
            <type>war</type>    
          </webapp> 
        </webapps> 
      </configuration>
    
    0 讨论(0)
提交回复
热议问题