首页 > 编程语言 >jenkins学习笔记之五:Maven、Ant、Gradl、Node构建工具集成

jenkins学习笔记之五:Maven、Ant、Gradl、Node构建工具集成

时间:2023-02-20 22:34:08浏览次数:59  
标签:Node bin tar Gradl Maven usr apache PATH local

一、jienkins集成Maven

1.安装Maven

下载地址:https://maven.apache.org/download.cgi

wget --no-check-certificate  https://dlcdn.apache.org/maven/maven-3/3.9.0/binaries/apache-maven-3.9.0-bin.tar.gz
tar xf apache-maven-3.9.0-bin.tar.gz -C /usr/local/
cd /usr/local/
ln -sv apache-maven-3.9.0 maven3.9
vim /etc/profile.d/maven.sh
export MAVEN_HOME=/usr/local/maven3.9
export PATH=$PATH:$MAVEN_HOME/bin
. /etc/profile.d/maven.sh
mvn -v

2.jenkins配置Maven

3.验证

编写jenkisnfile,保存并构建

查看输出

二、jenkins集成Ant

1.安装Ant

下载地址:https://ant.apache.org/bindownload.cgi
wget --no-check-certificate https://dlcdn.apache.org//ant/binaries/apache-ant-1.9.16-bin.tar.gz
tar xf apache-ant-1.9.16-bin.tar.gz -C /usr/local/
cd /usr/local/
ln -sv apache-ant-1.9.16 ant1.9
vim /etc/profile.d/ant.sh
export ANT_HOME=/usr/local/ant1.9
export PATH=$PATH:$MAVEN_HOME/bin:$ANT_HOME/bin

ant -version

2.jenkins配置Ant

系统管理->全局工具配置

3.验证

node {
stage ("build"){
    antHome = tool 'ANT'
    sh "${antHome}/bin/ant -version"
}
}

  

三、jenkins集成Gradle

1.安装Gradle

下载地址:https://gradle.org/releases/  
wget https://downloads.gradle.org/distributions/gradle-6.9.3-bin.zip
unzip gradle-6.9.3-bin.zip -d /usr/local/
ln -sv gradle-6.9.3 gradle6.9
vim /etc/profile.d/gradle.sh
export GRADLE_HOME=/usr/local/gradle6.9
export PATH=$PATH:$GRADLE_HOME/bin

. /etc/profile.d/gradle.sh
gradle -v

2.jenkins配置Gradle  

 

3.验证

编写jenkinsfile

node {
stage ("gradlebuild"){
    gradleHome = tool 'GRADLE'
    sh "${gradleHome}/bin/gradle -v"
}
}

四、jenkins集成Npm

1.安装npm

下载地址:https://nodejs.org/download/release/

#wget https://nodejs.org/download/release/v16.9.1/node-v16.9.1-linux-x64.tar.gz
wget --no-check-certificate https://npm.taobao.org/mirrors/node/v10.16.3/node-v16.9.1-linux-x64.tar.gz
tar xf node-v16.9.1-linux-x64.tar.gz -C /usr/local/
cd /usr/local/
ln -sv node-v16.9.1-linux-x64 node16

vim ~/.bash_profile
export PATH=/usr/local/node16/bin/:$PATH
 . ~/.bash_profile
node -v

2.jenkinsfile调用(在Jenkins全局工具配置中没有node)

node {
stage ("npmbuild"){
    sh """
       export npmHome=/usr/local/node16
       export PATH=\$PATH:\$npmHome/bin
       npm -v
       """
}    
}

 

 

标签:Node,bin,tar,Gradl,Maven,usr,apache,PATH,local
From: https://www.cnblogs.com/panwenbin-logs/p/17139002.html

相关文章