java wagon如何打包文件到不同服務器
更新時間:2019年06月29日 09:23:33 作者:海底蒼鷹
這篇文章主要介紹了java wagon如何打包文件到不同服務器,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友可以參考下
java需要編譯的,打包后文件要上傳到服務器。推薦二個辦法,
第一種,用jenkins,可以使用centos7 jenkins 發(fā)布vue ssr,編譯類的語言都可能過jenkins來發(fā)布,.net沒試過。
第二種,用wagon包來實現
1,修改pom.xml
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<serverId>${profiles.active}</serverId>
<fromFile>target/test.jar</fromFile>
<url>scp://root@${profiles.url}/var/www/java/target</url>
</configuration>
</plugin>
</plugins>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>2.8</version>
</extension>
</extensions>
</build>
<profiles>
<profile>
<!-- staging -->
<id>nlj-staging</id>
<properties>
<profiles.active>nlj-staging</profiles.active>
<profiles.resource>staging</profiles.resource>
<profiles.url>10.0.0.12</profiles.url> <profiles.updatePolicy>always</profiles.updatePolicy </properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>nlj-bms-prod</id>
<properties>
<profiles.active>nlj-bms-prod</profiles.active> <profiles.resource>production</profiles.resource>
<profiles.url>47.111.11.11</profiles.url> <profiles.updatePolicy>always</profiles.updatePolicy>
</properties>
</profile>
</profiles>
配置完,重新加載maven包。
2,打包,并上傳
# mvn clean package -Pnlj-staging -Dmaven.test.skip=true # mvn wagon:upload-single -Pnlj-staging 。。。。。。。。。。。。。。省略。。。。。。。。。。。。。。 [INFO] --- wagon-maven-plugin:1.0:upload-single (default-cli) @ test --- Password for root@10.0.0.12: ******* [INFO] Uploading: /Users/zhangying/Documents/www/target/test.jar scp://10.0.0.12/var/www/java/target/test.jar [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 40.392 s [INFO] Finished at: 2019-03-29T18:48:07+08:00 [INFO] Final Memory: 14M/176M [INFO] ------------------------------------------------------------------------
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
相關文章
簡單捋捋@RequestParam 和 @RequestBody的使用
這篇文章主要介紹了簡單捋捋@RequestParam 和 @RequestBody的使用,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2019-12-12
SpringCloud+Redis實現Api接口限流防止惡意刷接口
接口限流是為了保護系統(tǒng)和服務,防止因為過多的請求而崩潰,本文主要介紹了SpringCloud+Redis實現Api接口限流防止惡意刷接口,具有一定的參考價值,感興趣的可以了解一下2024-03-03
Java 將List中的實體類按照某個字段進行分組并存放至Map中操作
這篇文章主要介紹了Java 將List中的實體類按照某個字段進行分組并存放至Map中操作,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2020-10-10

