Blogger Information
Blog 291
fans 0
comment 0
visits 350738
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
Jenkins之Maven的配置
Original
654 people have browsed it

镜像下载、域名解析、时间同步请点击 阿里云开源镜像站

Maven集成

在Jenkins上发布Java项目时需要使用Maven来进行构建打包(Gradle项目则需要安装配置Gradle)

1.1 环境准备

这篇文章是在前一篇文章的基础上

maven包下载地址

  1. [root@192 java]# pwd //进入此目录
  2. /usr/local/java
  3. [root@192 java]# wget https://mirrors.aliyun.com/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
  4. // 解压包
  5. [root@192 java]# tar xf apache-maven-3.6.3-bin.tar.gz
  6. // 配置环境变量
  7. [root@192 ~]# cat /etc/profile.d/mvn.sh
  8. export MAVEN_HOME=/usr/local/java/apache-maven-3.6.3
  9. export PATH=$MAVEN_HOME/bin:$PATH
  10. [root@192 ~]# source /etc/profile.d/mvn.sh
  11. [root@192 ~]# mvn -version
  12. Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
  13. Maven home: /usr/local/java/apache-maven-3.6.3
  14. Java version: 1.8.0_181, vendor: Oracle Corporation, runtime: /usr/local/java/jdk1.8.0_181/jre
  15. Default locale: zh_CN, platform encoding: UTF-8
  16. OS name: "linux", version: "4.18.0-193.el8.x86_64", arch: "amd64", family: "unix"

1.2 Jenkins的web界面配置

// 点击管理Jenkins,再点击全局配置

file

// 点击新增maven

file

// 写maven的家目录,然后点击保存即可。

file

1.3 安装maven插件

// 点击管理Jenkins,再点击插件管理

file

// 在可选插件框中输入maven,第一个就是我们要安装的插件

file

// 安装完成之后重启Jenkins,如果一直卡在这个界面就手动刷新一个网页

file

// 安装完成之后在任务栏中就会出现maven

file

// 使用Jenkins用户在/data/software目录下新建一个repository文件夹,用来作为maven仓库

  1. [jenkins@192 software]$ pwd
  2. /data/software
  3. [jenkins@192 software]$ mkdir repository
  4. [root@192 conf]# vim settings.xml
  5. 52 | Default: ${user.home}/.m2/repository-->
  6. 53 <localRepository>/data/software/repository</localRepository>
  7. 54 -->
  8. 156 <url>http://my.repository.com/repo/path</url>
  9. 157 </mirror>
  10. 158 -->
  11. 159 <mirror>
  12. 160 <id>aliyun-maven</id>
  13. 161 <mirrorOf>central</mirrorOf>
  14. 162 <name>aliyun maven mirror</name>
  15. 163 <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
  16. 164 </mirror>
  17. 165 </mirrors>
  18. 166
  19. 167 <!-- profiles

原文链接:https://blog.csdn.net/qq_60387497/article/details/122925145

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post