0
我正在使用嵌入式tomcat來運行我的web應用程序。我使用tomcat7-maven-plugin(exec-war-mojo.html)將tomcat打包成jar文件。我使用該插件的配置是:無法更改目標'exec-war-only'的tomcat7-maven-plugin的mainClass
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.3-SNAPSHOT</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>exec-war-only</goal>
</goals>
</execution>
</executions>
<configuration>
<buildDirectory>${project.basedir}/</buildDirectory>
<path>/</path>
<finalName>${project.artifactId}.jar</finalName>
<enableNaming>true</enableNaming>
<mainClass>com.main.Main</mainClass>
</configuration>
</plugin>
的問題是,當我建立.jar文件,它不包含由屬性指向結果我無法運行.jar文件作爲文件它看起來對Main.class文件,我得到的錯誤
Error: Could not find or load main class com.main.Main
如果我不提<mainClass>
屬性,默認值是拿起這是org.apache.tomcat.maven.runner.Tomcat7RunnerCli
,一切運行正常。