1.无法打war包
a.Application.java添加@SpringBootApplication的类
b.可能添加了多个入口,cd到对应项目根目录,mvn package会
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.604s
[INFO] Finished at: Mon Aug 15 18:14:25 CST 2016
[INFO] Final Memory: 22M/226M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.4.0.RELEASE:repackage (default) on project beenoisy-spring-boot-way:
Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.4.0.RELEASE:
repackage failed: Unable to find a single main class from the following candidates
[
com.beenoisy.springboot.way.BeenoisySpringBootWayApplication,
com.beenoisy.springboot.way.TestConflict
] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
解决方案:maven配置文件加入start-class
<properties>
<start-class>com.beenoisy.springboot.way.BeenoisySpringBootWayApplication</start-class>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.7</java.version>
<tomcat.version>7.0.52</tomcat.version>
</properties>
2.将war包放入Tomcat报错
SEVERE: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngin
e[Catalina].StandardHost[localhost].StandardContext[/kfqjy-1.0.0]]
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catal
ina.LifecycleException: Failed to start component [StandardEngine[Catalina].Stan
dardHost[localhost].StandardContext[/kfqjy-1.0.0]]
发现项目默认内置Tomcat版本是8,而使用的Tomcat版本为7.
解决方案:
<tomcat.version>7.0.52</tomcat.version>
或
将7版本换成8版本