maven tomcat插件和tomcat有什么区别?

时间:2016-12-12 02:57:36

标签: java spring maven tomcat

当我使用maven tomcat插件来集成maven配置文件和spring配置文件时,但它失败了:无法在web.xml中使用占位符,我的maven install命令是:

clean install org.apache.tomcat.maven:tomcat6-maven-plugin:2.2:run --define maven.tomcat.port=8080 --define maven.tomcat.path=/ 

当我改为直接使用tomcat时,它起作用了。

web.xml:

<context-param>
    <param-name>spring.profiles.active</param-name>
    <param-value>${env}</param-value>
</context-param>

的pom.xml:

     <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-war-plugin</artifactId>
           <version>2.1-beta-1</version>
           <configuration>
               <archiveClasses>false</archiveClasses>
               <!-- activate spring profile -->
               <webResources>
                   <resource>
                       <filtering>true</filtering>
                       <directory>src/main/webapp</directory>
                       <includes>
                           <include>**/web.xml</include>
                       </includes>
                   </resource>
               </webResources>
               <warSourceDirectory>src/main/webapp</warSourceDirectory>
               <webXml>src/main/webapp/WEB-INF/web.xml</webXml>
           </configuration>
       </plugin>

0 个答案:

没有答案