Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information.
Jenkins ver. 2.32.1
Step 1: Install JDK
官方站点 http://openjdk.java.net/install/
-- The openjdk-8-jre package contains just the Java Runtime Environment.
-- If you want to develop Java programs then please install the openjdk-8-jdk package.
# install jdk
sudo apt-get install openjdk-8-jdk -y
# make sure the jdk install success
java -version
openjdk version "1.8.0_111"
OpenJDK Runtime Environment (build 1.8.0_111-8u111-b14-2ubuntu0.16.04.2-b14)
OpenJDK 64-Bit Server VM (build 25.111-b14, mixed mode)
# now jdk installed, Let's add JAVA_HOME Env variable
cat > /etc/profile.d/java-8-openjdk.sh << EOF
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
PATH=\$JAVA_HOME/bin:\$PATH
export JAVA_HOME PATH
EOF
source /etc/profile.d/java-8-openjdk.sh
Step 2: Downloading and Setting Up Maven
maven 的官方下载站点 Apache Maven Download. 在我写这篇文章的时候,Maven 的最新版本是 3.3.9.
cd /usr/local/src
wget http://mirror.its.dal.ca/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
tar xf apache-maven-3.3.9-bin.tar.gz
mv apache-maven-3.3.9 /usr/local/
cat > /etc/profile.d/apache-maven.sh << EOF
MAVEN_HOME=/usr/local/apache-maven-3.3.9
export MAVEN_HOME
export PATH=\${PATH}:\${MAVEN_HOME}/bin
EOF
source /etc/profile.d/apache-maven.sh
# 查看 maven 版本
# mvn -v
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T05:41:47-11:00)
Maven home: /usr/local/apache-maven-3.3.9
Java version: 1.8.0_111, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-57-generic", arch: "amd64", family: "unix"
Step 3: Setting up Jenkins JDK and Maven
登陆 Jenkins dashboard,点击 系统管理 --> Global Tool Configuration -- > JDK 安装 --> Maven安装 最后保存配置
Step 4: Install Maven Plugin
参见 How-to install jenkins plugin via manual installation
cd /var/lib/jenkins/plugins
wget http://updates.jenkins-ci.org/download/plugins/javadoc/1.4/javadoc.hpi
wget http://updates.jenkins-ci.org/download/plugins/maven-plugin/2.14/maven-plugin.hpi
/etc/init.d/jenkins restart
Now You can create Maven Project
~~~ EOF ~~~