标签:打包 framework cut pre classes tom extend meta xtend
1. jar包部署
maven插件:
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build>
如果没有加插件,就执行jar包
java -jar xxx.jar
错误信息:no main manifest attribute, in xxx.jar
如果有安装maven就直接用maven打包就行
jar包的目录结构
example.jar | +-META-INF | +-MANIFEST.MF +-org | +-springframework | +-boot | +-loader | +-<spring boot loader classes> +-BOOT-INF +-classes | +-mycompany | +-project | +-YourClasses.class +-lib +-dependency1.jar +-dependency2.jar
https://docs.spring.io/spring-boot/docs/2.1.0.BUILD-SNAPSHOT/reference/htmlsingle/#executable-jar-jar-file-structure
2. war包启动
1)在pom.xml中将打包形式 jar 修改为war <packaging>war</packaging>
2)构建项目名称在<bulid>里面 <finalName>xdclass_springboot</finalName>
3)放置到tomcat里面的webapp里面
4)修改启动类
// 进行初始化
public class WebApplication extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(WebApplication.class); } public static void main(String[] args) throws Exception { SpringApplication.run(WebApplication.class, args); } }
5)打包,启动
标签:打包 framework cut pre classes tom extend meta xtend
原文地址:https://www.cnblogs.com/sjzxxy/p/12597602.html