linux 编译环境包,linux上war包编译环境搭建(示例代码)
一.檢查linux機器上是否有自帶的jdk
Java -version檢查下就可以,如果有與編譯需要的版本不同,先卸載,再安裝編譯需要的版本
jdk安裝與配置.
(1)jdk安裝
解壓縮包:
#tar -xvzf jdk1.7.tar.gz -C /home/ai? #解壓縮包到指定目錄下。
(2)配置環(huán)境變量
修改全局環(huán)境變量 /etc/profile
export JAVA_HOME=/home/ai/jdk1.7.0_79
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
二.安裝maven
(1)將下載好的maven安裝包解壓到指定目錄
#tar -xvzf apache-maven-3.3.9.tar.gz -C /home/ai #解壓縮包到指定目錄下。
(2)配置settings.xml文件
/home/ai/mavenRepository
#/home/ai/mavenRepository為maven倉庫的存儲目錄
注意:如果無法連接網絡,則需要手動將工程需要的倉庫jar包上傳。
(3)配置maven環(huán)境變量
修改全局環(huán)境變量 /etc/profile
export MAVEN_HOME=/home/ai/apache-maven-3.3.9
export M2_HOME=/home/ai/apache-maven-3.3.9
export PATH=$PATH:$MAVEN_HOME/bin:$M2_HOME/bin
三.svn 下載工程
svn co http://路徑(目錄或文件的全路徑) [本地目錄全路徑] --username 用戶名 --password 密碼
svn co svn://10.4.63.11/quartzProject/maintain /home/ai/maintain --username lkk --password ***
四.到指定目錄輸入編譯命令。
[[email?protected] maintain]$ mvn clean package -Dmaven.test.skip=true &
[[email?protected] ~]$ [INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building maintain maven 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ maintain ---
[INFO] Deleting /home/ai/maintain/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ maintain ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] Copying 42 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ maintain ---
[INFO] Compiling 430 source files to /home/ai/maintain/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ maintain ---
[INFO] Not copying test resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ maintain ---
[INFO] Not compiling test sources
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ maintain ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) @ maintain ---
[INFO] Packaging webapp
[INFO] Assembling webapp [maintain] in [/home/ai/maintain/target/maintain-1.0-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [/home/ai/maintain/src/main/webapp]
[INFO] Webapp assembled in [961 msecs]
[INFO] Building war: /home/ai/maintain/target/maintain-1.0-SNAPSHOT.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19.834 s
[INFO] Finished at: 2017-01-09T19:14:24+08:00
[INFO] Final Memory: 66M/1963M
[INFO] ------------------------------------------------------------------------
編譯成功,生成的war包位于/home/ai/maintain/target/maintain-1.0-SNAPSHOT.war目錄下
總結
以上是生活随笔為你收集整理的linux 编译环境包,linux上war包编译环境搭建(示例代码)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux分区合并不损坏系统,更改磁盘分
- 下一篇: linux 历史命令列表,fc – 显示