使用的idea。
注意:apache-tomcat-9.0.0.M19和apache-tomcat-8.5.13 部署不成功,原因未知。不要用这两个版本的tomcat(能解决的高手除外)。
我用的tomcat:

<meta charset="utf-8">
1.修改 conf/tomcat-user.xml,添加:

2.vi webapps/manager/META-INF/context.xml

搞掂1,2步,重启下tomcat。
3.项目POM.xml加上插件
<dependencies>
<dependency>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://服务器IP:端口/manager/text</url>
<username>admin</username>
<password>good</password>
<path>/ROOT</path>
<charset>utf8</charset>
<update>true</update>
</configuration>
</plugin>
</plugins>
</build>
这里用户名和密码就是第一步设置的那个。
到这里,配置完成,可以用了:

网友评论