我使用Maven Tomcat插件运行maven目标“clean install”:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<url>http://localhost:8080/manager/html</url>
<server>TomcatServer</server>
<failOnError>false</failOnError>
<path>/spring-training</path>
<fork>true</fork>
</configuration>
<executions>
<execution>
<id>01-start-tomcat</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<id>02-stop-tomcat</id>
<phase>post-integration-test</phase>
<goals>
<goal>shutdown</goal>
</goals>
</execution>
</executions>
</plugin>
并收到错误:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'logBeanFactoryPostProcessor' defined in URL [jar:file:/D:/projects/MainSpringProject/SpringSubProject/General/target/General-1.0-SNAPSHOT.jar!/com/springproject/ioc/LogBeanFactoryPostProcessor.class]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.config.internalTransactionAdvisor': Cannot resolve reference to bean 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0' while setting bean property 'transactionAttributeSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: warning no match for this type name: com.noveogroup.springtrainig.service.ApplicationService [Xlint:invalidAbsoluteTypeName]
我引起你的注意如果我运行maven“clean package”并手动部署到tomcat中有没有错误!,但是当我和tomcat-maven一样时插件我得到这样的错误。可能是什么问题?
答案 0 :(得分:0)
我建议从更简单(和更新)的配置开始:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0</version>
<configuration>
<port>9090</port>
<useTestClasspath>true</useTestClasspath>
<path>/</path>
</configuration>
</plugin>
然后你应该能够使用命令行启动tomcat:
mvn tomcat7:run
请注意,这将启动嵌入式tomcat服务器,这可确保您不依赖于在构建计算机上安装Tomcat的位置。