- JDK:在maven3.3 以上的版本需要JDK版本1.7+。内存:没有最低限制。
- 磁盘:1G+可用磁盘空间。 操作系统:没有限制。
- 下载maven Download
tar zxf apache-maven-3.6.0-bin.tar.gz -C /usr/local/
#设置全局变量(/etc/profile)
export MAVEN_HOME=/usr/local/apache-maven-3.6.0
export PATH=$PATH:$MAVEN_HOME/bin
source /etc/profile
node {
stage ("build"){
mavenHome = tool 'M3'
sh "${mavenHome}/bin/mvn -v"
}
}
clean install -DskipTests
clean package
- 下载:Download
tar zxf apache-ant-1.10.5-bin.tar.gz -C /usr/local/
#添加全局变量(/etc/profile)
export ANT_HOME=/usr/local/apache-ant-1.10.5
export PATH=$PATH:$MAVEN_HOME/bin:$ANT_HOME/bin
source /etc/profile
node {
stage ("build"){
antHome = tool 'ANT'
sh "${antHome}/bin/ant -version"
}
}
ant -buildfile -f build.xml
- 下载: Download
unzip gradle-5.3-bin.zip -d /usr/local/
#添加全局变量(/etc/profile)
export GRADLE_HOME=/usr/local/gradle-5.3
export PATH=$PATH: $GRADLE_HOME/bin
source /etc/profile
node {
stage ("gradlebuild"){
gradleHome = tool 'GRADLE'
sh "${gradleHome}/bin/gradle -v"
}
}
- ./gradlew -v 版本号,首次运行,没有gradle的要下载的哦。
- ./gradlew clean 删除HelloWord/app目录下的build文件夹
- ./gradlew build 检查依赖并编译打包
- ./gradlew assembleDebug 编译并打Debug包
- ./gradlew assembleRelease 编译并打Release的包
- ./gradlew installRelease Release模式打包并安装
- ./gradlew uninstallRelease 卸载Release模式包
- 下载Download
tar xf node-v10.15.3-linux-x64.tar.xz -C /usr/local/
#添加全局变量(/etc/profile)
export NODE_HOME=/usr/local/node-v10.15.3-linux-x64
export PATH=$PATH: $NODE_HOME/bin
source /etc/profile
-
在Jenkins全局工具配置中并没有node,可以直接通过Jenkinsfile定义使用。
-
Jenkinsfile
node {
stage ("npmbuild"){
sh """
export npmHome=/usr/local/node-v10.15.3-linux-x64
export PATH=\$PATH:\$npmHome/bin
npm -v
"""
}
}
npm install && npm run build