java wagon如何打包文件到不同服務(wù)器
java需要編譯的,打包后文件要上傳到服務(wù)器。推薦二個辦法,
第一種,用jenkins,可以使用centos7 jenkins 發(fā)布vue ssr,編譯類的語言都可能過jenkins來發(fā)布,.net沒試過。
第二種,用wagon包來實現(xiàn)
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] ------------------------------------------------------------------------
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
Java SpringMVC 異常處理SimpleMappingExceptionResolver類詳解
這篇文章主要介紹了SpringMVC 異常處理SimpleMappingExceptionResolver類詳解,本篇文章通過簡要的案例,講解了該項技術(shù)的了解與使用,以下就是詳細(xì)內(nèi)容,需要的朋友可以參考下2021-09-09
SpringCloud客戶端報錯:- was unable to send&nb
這篇文章主要介紹了SpringCloud客戶端報錯:- was unable to send heartbeat!的問題及解決方案,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2022-05-05
Java 實戰(zhàn)項目錘煉之在線蛋糕商城系統(tǒng)的實現(xiàn)
讀萬卷書不如行萬里路,只學(xué)書上的理論是遠(yuǎn)遠(yuǎn)不夠的,只有在實戰(zhàn)中才能獲得能力的提升,本篇文章手把手帶你用java+jsp+jdbc+mysql實現(xiàn)一個在線蛋糕商城系統(tǒng),大家可以在過程中查缺補(bǔ)漏,提升水平2021-11-11
Servlet編程第一步之從零構(gòu)建Hello?World應(yīng)用詳細(xì)步驟+圖解
本文詳細(xì)介紹了Servlet和maven的基本概念及其在JavaWeb開發(fā)中的應(yīng)用,首先解釋了Servlet是一個在服務(wù)器上處理請求的Java程序,然后介紹了maven作為管理和構(gòu)建Java項目的工具,需要的朋友可以參考下2024-10-10

