1. In the process of development, it is troublesome to package the program on the server and restart Tomcat.
I have to do the following steps myself:
1), package with maven command
2), the package is dropped through FileZilla to the server Tomcat/webapps
3), bin/shutdown.sh
4), bin/startup.sh
2. Cargo is mentioned in the book "Maven Combat," which enables automated deployment. But it doesn't seem to be a use to knock the code up.
3. So I went online to check the data test.
First introduce my environment here, tomcat8x, and most of the online is tomcat6, so go to the official website to find: Click to open the link
Click on the left side of the column to see a tomcat8, this point.
Find Containerid after entering:
Then pull to the bottom and see tips:
So set the URI to .../manager/text
Then edit the target server's Tomcat Conf/tomcat-users.xml file
The final document reads as follows:
<?xml version= ' 1.0 ' encoding= ' utf-8 '?> <!--licensed to the Apache Software Foundation (ASF) under one or more Contributor license agreements.
The NOTICE file distributed with this work for additional information regarding copyright. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); You are not to use this file except in compliance with the License. Obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 unless required by applicable Agreed to writing, software distributed under the License was distributed on ' as is ' basis, without Warra
Nties or CONDITIONS of any KIND, either express OR implied.
The License for the specific language governing permissions and limitations under the License. --> <tomcat-users xmlns= "Http://tomcat.apache.org/xml" xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-ins" Tance "xsi:schemalocation=" http:Tomcat.apache.org/xml tomcat-users.xsd "version=" 1.0 "> <!--note:by default, no user is included In the ' Manager-gui ' required to operate the '/manager/html ' Web application.
If you are wish to use this app, you must define such a user-the username and password are. --> <!--note:the Sample user and role entries below are wrapped into a comment and thus are when ignored G This file. Don't forget to remove <!.. ..
> that surrounds them. --> <role rolename= "Manager-gui"/> <role "rolename= manager-script"/> <role rolename= "MANAGER-JMX"/ > <role rolename= "manager-status"/> <role rolename= "Admin-gui"/> <user username= "admin" password= " Password "roles=" Admin-gui,manager-gui,manager-script,manager-status "/> </tomcat-users>
And then paste the code for the plugin section in the Pom.xml file.
<plugin> <groupId>org.codehaus.cargo</groupId> <artifactid>cargo-maven
2-plugin</artifactid> <version>1.4.16<version> <configuration> <container> <containerId>tomcat8x</containerId> &
Lt;type>remote<type> </container> <configuration> <type>runtime<type> <properties> <cargo.remote .uri>http://192.168.199.158:8080/manager/text</cargo.remote.uri> <cargo.remote.usern Ame>admin</cargo.remote.username> <cargo.remote.password>password</cargo.remot e.password> </properties> </configuration> </confi Guration> ≪/plugin>
Here's an explanation:
The Username,password in Pom.xml is consistent with the settings in the Tomcat configuration.
The URL in Pom.xml is then the destination host URL, followed by Manager/text.
Finally, execute MVN cargo:redeploy
4. Previous Mistakes
The idea was to remotely connect to the destination host, then pass the file over and restart Tomcat.
So I'm going to do it before I do the SSH connection between the client and the destination host, with the username of the operating system and the password of course, so Username,password is wrong in the configuration.
Until you look at the changes to the Tomcat profile and find that you want the Tomcat password, the principle should be: Visit Tomcat's manager, listen to the name and know that it manages the transfer of files, deployment, and so on, without the operating system username and password.
Finally, stick to the successful Tomcat log