通过 Maven 嵌入 Tomcat 的库
Libraries for embedded Tomcat via Maven
使用以下设置
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<port>9090</port>
<path>/</path>
<contextFile>src/main/resources/config/tomcat/context.xml</contextFile>
<executions>
<execution>
<id>start-tomcat</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<id>stop-tomcat</id>
<phase>post-integration-test</phase>
<goals>
<goal>shutdown</goal>
</goals>
</execution>
</executions>
</plugin>
当我运行
mvn install tomcat7:run-war-only
我收到以下错误
...Caused by: java.lang.NoClassDefFoundError: javax/jms/ConnectionFactory...
将包含javax/jms/ConnectionFactory的jms.jar放入target\tomcat\lib中并不能解决问题,否则我怎么能要求javax嵌入tomcat?
我为此苦苦挣扎了很长时间,任何提示都将不胜感激。
按照@ujulu 的建议在插件内部使用:)
使用以下设置
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<port>9090</port>
<path>/</path>
<contextFile>src/main/resources/config/tomcat/context.xml</contextFile>
<executions>
<execution>
<id>start-tomcat</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<id>stop-tomcat</id>
<phase>post-integration-test</phase>
<goals>
<goal>shutdown</goal>
</goals>
</execution>
</executions>
</plugin>
当我运行
mvn install tomcat7:run-war-only
我收到以下错误
...Caused by: java.lang.NoClassDefFoundError: javax/jms/ConnectionFactory...
将包含javax/jms/ConnectionFactory的jms.jar放入target\tomcat\lib中并不能解决问题,否则我怎么能要求javax嵌入tomcat?
我为此苦苦挣扎了很长时间,任何提示都将不胜感激。
按照@ujulu 的建议在插件内部使用:)