一、开发环境:
1.windows服务器;
2.idea 2018.3;
3.tomcat 8.5.50;
4.springboot 1.5.9;
二、sftp文件传输协议
windows本身不支持sftp协议,安装freessh软件可以解决!
freesshd下载:http://www.freesshd.com/?ctt=download

安装无脑下一步,
添加用户:

监听服务:


监听配置仅配置ssh亦可;
认证:

根目录设置:

启动服务

若启动失败,错误提示为端口占用,可任务管理关闭该软件的进程,重试一般就可以了。
三、tomcat设置
创建用户
tomcat目录:/conf/tomcat-users.xm添加用户权限配置
<?xml version="1.0" encoding="UTF-8"?>
<tomcat-users xmlns="http://tomcat.apache.org/xml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
version="1.0">
<!-- 用户配置 -->
<role rolename="manager-gui" /> <!--允许访问HTML GUI和状态页-->
<role rolename="manager-script" /> <!--允许访问文本接口和状态页-->
<role rolename="manager-jmx" /> <!--允许访问JMX代理和状态页-->
<role rolename="manager-status" /> <!--仅允许访问状态页-->
<user username="admin" password="admin" roles="manager-gui, manager-script"/>
</tomcat-users>
添加配置文件
tomcat目录:/conf/Catalina/localhost/manager.xml
<?xml version="1.0" encoding="UTF-8"?>
<Context privileged="true" antiResourceLocking="false" docBase="${catalina.home}/webapps/manager">
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="^.*$" />
</Context>
或许你会用到
tomcat目录:/conf/context.xml
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
<!-- 缓存设置 -->
<Resources
cachingAllowed="true"
cacheMaxSize="100000"
/>
</Context>
tomcat目录:/conf/logging.properties
...
java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = org.apache.juli.OneLineFormatter
java.util.logging.ConsoleHandler.encoding = GBK <!--控制台输出乱码设置-->
...
四、maven设置
maven仓库配置文件
maven目录:/conf/logging.properties
<servers> </servers>节点中添加:
<server>
<id>remote</id> <!--自定义id-->
<username>admin</username> <!--用户名-->
<password>admin</password> <!--密码-->
</server>
五、pom文件maven依赖设置
<!-- 配置Tomcat插件 -->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<!-- 此处的名字必须和 第四项 maven设置中/conf/settings.xml中配置的server节点的id一致-->
<server>remote</server>
<!--服务器端口号-->
<port>8080</port>
<!-- 项目发布的路径,默认就是tomcat/webapps目录,
若为"",则默认在webapps目录下部署 [项目名].war包
若为"/",则默认在webapps目录下部署 ROOT.war包
若为"springboot-1.0",则默认在webapps目录下部署 springboot-1.0.war包
-->
<path></path>
<!-- 注意tomcat7此处的url,不能随意修改,后缀必须是text-->
<url>http://[服务器ip]:8080/manager/text</url>
<!--解决中文参数乱码问题-->
<uriEncoding>UTF-8</uriEncoding>
<update>true</update>
<!--配置在tomcat\conf\tomcat-users.xml中定义的用户名-->
<username>admin</username>
<password>admin</password>
</configuration>
</plugin>
注意:springboot项目,需移除内置tomcat,相关设置可自行百度,
或参考https://www.jianshu.com/p/a79674b0fd5d中:1.修改pom.xml文件、2.修改启动类
六、顺序启动
启动tomcat

打包发布

使用命令打包发布亦可:

mvn clean package tomcat7:deploy
参考链接:
[freeshd安装]:https://blog.csdn.net/imjcoder/article/details/79171660
[tomcat、maven、pom配置]:https://www.jianshu.com/p/d4585b83b9dd?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation
完毕!
网友评论