测试开发实践

Jenkins插件编译

2017-09-24  本文已影响20人  严北

环境说明


maven环境搭建

maven安装与配置

$ sudo tar -zxvf apache-maven-3.5.0-bin.tar.gz -C /usr/local/
export M2_HOME=/usr/local/apache-maven-3.5.0
export M2=$M2_HOME/bin
export MAVEN_OPTS="-Xms128m -Xmx1024m"
export PATH=$M2:$PATH
<?xml version="1.0" encoding="UTF-8"?>

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <pluginGroups>
  </pluginGroups>
  <proxies>
  </proxies>
  <servers>
  </servers>
  <mirrors>
      <mirror>
          <id>alimaven</id>
          <mirrorOf>central</mirrorOf>
          <name>aliyun maven</name>
          <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
      </mirror>
  </mirrors>
  <profiles>
      <profile>
          <id>jdk-1.8</id>
          <activation> 
              <activeByDefault>true</activeByDefault>
              <jdk>1.8</jdk> 
          </activation>
          <properties> 
              <maven.compiler.source>1.8</maven.compiler.source> 
              <maven.compiler.target>1.8</maven.compiler.target> 
              <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion> 
          </properties> 
      </profile>
  </profiles>
</settings>
$ mvn -v

出现如下结果即为配置成功

Apache Maven 3.5.0 ...
Maven home: ...
Java version: 1.8.0 ...
Java home: ...
Default locale: ...
OS name: ...

Jenkins插件源码编辑

本教程使用Dingding Notification Plugin为例;
更多hpi教程请移步Jenkins官网。

$ git clone https://github.com/jenkinsci/dingding-notifications-plugin.git

编译与使用hpi(Hudson Plugin)

mvn package

即可生成hpi与jar包。


参考资料

[1]. 十佳菜鸟,《deepin安装maven》,CSDN,08,2017
[2]. supereagle,《Jenkins的plugin开发》,CNBLOG,08,2013

上一篇 下一篇

猜你喜欢

热点阅读