Maven 配置
选择自已的setting配置文件
JDK 安装
指定自己的jdk目录
Git
指定自己的git,如果系统已经安装,会自动检测到
Maven
指定自己的maven目录
添加帮助类
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan
@EnableAutoConfiguration
public class RenrenApplicationWeb extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(RenrenApplicationWeb.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(RenrenApplication.class);
}
}
pom依赖
provided指定tomcat相关jar包不会打包进war,使用容器的jar包
org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-tomcat org.springframework.boot spring-boot-starter-tomcat provided
finalName指定war包的名称,也是容器的访问路径
tomcat配置generator org.springframework.boot spring-boot-maven-plugin
修改端口
修改apache-tomcat-8.5.34confserver.xml文件
这里把8080修改成了8089
新增用户
修改apache-tomcat-8.5.34conftomcat-users.xml文件
以下为tomcat内置的管理角色
Built-in Tomcat manager roles:
- manager-gui - allows access to the HTML GUI and the status pages
- manager-script - allows access to the HTTP API and the status pages
- manager-jmx - allows access to the JMX proxy and the status pages
- manager-status - allows access to the status pages only
新增用户tomcat_user并给他管理角色权限,这样jenkins才能把war包发布到tomcat容器中
新建item并配置
构建一个maven项目
如果没有构建一个maven项目选项,请下载Maven Integration plugin
mvn clean package -Dmaven.test.skip=true -P dev
至此部署完成,点击构建自动部署
访问http://localhost:8089/generator/



