首页 > 代码库 > linux上war包编译环境搭建

linux上war包编译环境搭建

一.检查linux机器上是否有自带的jdk
    Java -version检查下就可以,如果有与编译需要的版本不同,先卸载,再安装编译需要的版本
    jdk安装与配置.
    (1)jdk安装
    解压缩包:
    #tar -xvzf jdk1.7.tar.gz -C /home/ai  #解压缩包到指定目录下。
 (2)配置环境变量
 修改全局环境变量 /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文件
 <localRepository>/home/ai/mavenRepository</localRepository>
 #/home/ai/mavenRepository为maven仓库的存储目录
 注意:如果无法连接网络,则需要手动将工程需要的仓库jar包上传。
 (3)配置maven环境变量
  修改全局环境变量 /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 ***
四.到指定目录输入编译命令。
   [ai@Database2 maintain]$ mvn clean package -Dmaven.test.skip=true &
   [ai@Database2 ~]$ [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目录下
  
  
  

本文出自 “梦Dream” 博客,请务必保留此出处http://dreamy.blog.51cto.com/12471447/1891637

linux上war包编译环境搭建