The plugin's maven dependency is:
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId> wagon-maven-plugin</artifactid>
<version>1.0</version>
</dependency>
The document address of the plugin is:
http://www.mojohaus.org/wagon-maven-plugin/
Mainly provides the following several goal
Wagon:upload-single uploads the specified file to a remote location.
Wagon:upload uploads the specified set of files to a remote location.
Wagon:download-single downloads the specified file from a remote location.
Wagon:download downloads the specified set of files from a remote location.
Wagon:list lists the content of a specified location in a remote repository.
Wagon:copy copies a set of files under a wagon repository to another.
Wagon:merge-maven-repos merges, including metadata, a Maven repository to another.
Wagon:sshexec executes a set of commands at remote SSH host.
Use the following:
In order for the Wagon-maven-plugin plugin to ssh into a Linux server, you first need to configure the server's user name and password in MAVEN configuration file settings.xml.
<server>
<id>webserver</id>
<username>hadoop</username>
<password >123</password>
</server>
With this plugin, you need to configure the following in the build
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
< artifactid>wagon-ssh</artifactid>
<version>2.10</version>
</extension>
</extensions>
The following shows a procedure for deploying a war to Tomcat using the query
<build> <finalName>osc-shop</finalName> <extensions> <extension> <groupId>org.apache.maven.wagon</groupId> <artifactid>wagon-ssh</artifactid>
;
<version>2.10</version> </extension> </extensions> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactid>wagon-maven
-plugin</artifactid> <version>1.0</version> <configuration> <serverId>webserver</serverId> <!--files to deploy-<fromfile >target/osc-shop.war</fromFile> <!--deployment Directory-<url>scp://hadoop@1
92.168.1.222/home/hadoop/apache-tomcat-8.0.5/webapps/</url> <commands> <!--off Tomcat--<command>/home/hadoop/apache-tomcat-8.0.5/bin/shutdown.sh& lt;/command> <!--Remove the previously unpacked directory--<command>rm-rf/home/hadoop/a
Pache-tomcat-8.0.5/webapps/osc-shop </command> <!--start Tomcat-- <command>/home/hadoop/apache-tomcat-8.0.5/bin/startup.sh</command> < /commands> <displayCommandOutputs>true</displayCommandOutputs> </configu ration> </plugin> </plugins> </build>
After the configuration is complete, execute the command
MVN clean package wagon:upload-single wagon:sshexec
to deploy to the server and reboot Tomcat