博客园  :: 首页  :: 联系 :: 订阅 订阅  :: 管理

Jenkins插件开发(6.3)—— 追踪jenkins-cli.jar

Posted on 2013-04-19 15:00  Bruce Zhang  阅读(962)  评论(0编辑  收藏  举报

通常,我们都是在Jenkins安装完成后,从系统提供的地址下载jenkins-cli.jar,用以运行CLI脚本:

Step1: 下载完成后,发现jenkins-cli也是一个单独的maven模块:

  <modelVersion>4.0.0</modelVersion>
  <parent>
    <artifactId>pom</artifactId>
    <groupId>org.jenkins-ci.main</groupId>
    <version>1.510</version>
  </parent>
  <artifactId>cli</artifactId>
  <name>Jenkins CLI</name>

Step2: 然后又发现,jenkins-core是依赖jenkins-cli的:

Step3: 打开cli的pom.xml后,又很方便的找到了其MainClass的定义“hudson.cli.CLI”:

  <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <!-- version specified in grandparent pom -->
        <executions>
          <execution>
            <goals>
              <goal>attached</goal>
            </goals>
            <phase>package</phase>
            <configuration>
              <descriptorId>jar-with-dependencies</descriptorId>
              <archive>
                <manifest>
                  <mainClass>hudson.cli.CLI</mainClass>
                </manifest>
                <manifestEntries>
                  <Jenkins-CLI-Version>${build.version}</Jenkins-CLI-Version>
                </manifestEntries>
              </archive>
            </configuration>
          </execution>
        </executions>
      </plugin>