zoukankan      html  css  js  c++  java
  • Jenkins构建maven项目

    准备工作:

    若Jenkins是全新安装,则要构建maven项目,还应在服务器上安装jdk和maven并进行配置。(这里jdk的安装不作介绍)

    安装maven
    [root@ipha-dev71-1 local]# cd /usr/local [root@ipha-dev71-1 local]# mkdir maven [root@ipha-dev71-1 local]# ll total 12740 drwxr-xr-x. 2 root root 6 Nov 5 2016 bin drwxr-xr-x. 2 root root 6 Nov 5 2016 etc drwxr-xr-x. 2 root root 6 Nov 5 2016 games drwxr-xr-x. 2 root root 6 Nov 5 2016 include drwxr-xr-x. 2 root root 6 Nov 5 2016 lib drwxr-xr-x. 2 root root 6 Nov 5 2016 lib64 drwxr-xr-x. 2 root root 6 Nov 5 2016 libexec drwxr-xr-x 2 root root 6 Aug 12 16:34 maven drwxrwxr-x 6 500 500 108 Aug 7 00:02 node -rw-r--r-- 1 root root 13043892 Aug 7 00:03 node-v10.16.2-linux-x64.tar.xz drwxr-xr-x 7 root root 100 Jan 25 2019 python3 drwxr-xr-x. 2 root root 6 Nov 5 2016 sbin drwxr-xr-x. 5 root root 49 Jan 22 2018 share drwxr-xr-x. 2 root root 6 Nov 5 2016 src [root@ipha-dev71-1 local]# cd maven/ [root@ipha-dev71-1 local]# wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz --2019-08-12 16:37:36-- http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz Resolving mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.8.193 Connecting to mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.8.193|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 9136463 (8.7M) [application/x-gzip] Saving to: ‘apache-maven-3.6.1-bin.tar.gz’ 100%[==============================================================================================================================>] 9,136,463 27.7MB/s in 0.3s 2019-08-12 16:37:44 (27.7 MB/s) - ‘apache-maven-3.6.1-bin.tar.gz’ saved [9136463/9136463]
    [root@ipha-dev71-1 maven]# tar -xvf apache-maven-3.6.1-bin.tar.gz
    [root@ipha-dev71-1 apache-maven-3.6.1]# pwd
    /usr/local/maven/apache-maven-3.6.1
    [root@ipha-dev71-1 apache-maven-3.6.1]# vim /etc/profile # 配置环境变量,添加如下两行

    export MAVEN_HOME=/usr/local/maven/apache-maven-3.6.1
    export PATH=$MAVEN_HOME/bin:$PATH
    [root@ipha-dev71-1 apache-maven-3.6.1]# source /etc/profile # 使环境变量生效
    [root@ipha-dev71-1 apache-maven-3.6.1]# mvn -v # 检测maven是否安装成功
    Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-05T03:00:29+08:00)
    Maven home: /usr/local/maven/apache-maven-3.6.1
    Java version: 1.8.0_112, vendor: Oracle Corporation, runtime: /mnt/yyspace/soft/jdk1.8.0_112/jre
    Default locale: en_US, platform encoding: UTF-8

    然后在Jenkins的 系统设置-系统管理-全局工具配置 配置jdk与maven

     

     至此,构建maven项目的准备工作已完成。

    1.新建一个 maven项目 的任务(若没有下图中的maven项目选项,则需要从系统设置-插件管理 安装插件Maven Integration plugin

     2.配置git

    3.配置build

    4.执行构建就可以啦

  • 相关阅读:
    spring中bean的高级属性之list, set, map以及props元素(含举例)
    Schema约束与DTD约束
    spring中配置Properties对象的方法
    web.xml 中的listener、 filter、servlet 加载顺序及其详解
    MySql为某个表增加rownumber
    分组取前N记录(转)
    1、Spring MVC的web.xml配置详解(转)
    Spring的PropertyPlaceholderConfigurer应用(转)
    几种任务调度的 Java 实现方法与比较(定时任务)(转)
    Spring定时任务的几种实现(转)
  • 原文地址:https://www.cnblogs.com/wang-mengmeng/p/11340302.html
Copyright © 2011-2022 走看看