mfks17's blog(Life is Good !!)

趣味や思った事を書いていくと思います

JenkinsのPluginを作るときのメモ

みんなの心強いメンバーであるJenkinsさんのプラグインを作りたいと思ったので、調査の課程をメモとして残しておきたいと思います。

で、なにつくんの?


  • push通知を使った、Notification 機能。
  • Jenkinsがトリガーを受け取ってipaを作成後、サーバにアップ
  • クライアントサイドの通知、開くとダウンロードページに飛ぶ(恐らくモバイルsafariで開く)
  • リンクをクリックするとダウンロード開始

なんでそんなん欲しいの


  • TestFlightは会社てきにあれ
  • なるべくJenkinsさんですべて済ましたい
  • コミュニティへの貢献
  • 誰か使ってくれたらうれしいなって

恐らく、公開されていないだけで既に、誰かが作っているとは思うのですが、、
そんなことは気にしない。
githubにはもう上がっているみたいです。

2013/05/04時点でのiOS関連のプラグイン

まだまだ、他に比べたら少ないですね。

今回の検証環境


  • macbookair Late 2012
  • OSX 10.8.2
  • Xcode4.6

必要なもの



JDKのインストール


OSがMountain LionなのでAppleが定休しているJavaをつかいます。
ここで、インストーラが出てこないバグに遭遇したら、こちらが参考になると思います。

Mavenのインストール


Homebrewでいれます。
$ brew install maven
==> Downloading http://www.apache.org/dyn/closer.cgi?path=maven/maven-3/3.0.4/binaries/apache-maven-3.0.4-bin.tar.gz
==> Best Mirror http://ftp.yz.yamagata-u.ac.jp/pub/network/apache/maven/maven-3/3.0.4/binaries/apache-maven-3.0.4-bin.tar.gz
######################################################################## 100.0%
/usr/local/Cellar/maven/3.0.4: 40 files, 5.4M, built in 18 seconds


るーびーの絵文字がいかしてますね
Mavenがインストールできました
$ mvn -version
Listening for transport dt_socket at address: 8000
Apache Maven 3.0.4 (r1232337; 2012-01-17 17:44:56+0900)
Maven home: /usr/local/Cellar/maven/3.0.4/libexec
Java version: 1.6.0_37, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: ja_JP, platform encoding: MacRoman
OS name: "mac os x", version: "10.8.2", arch: "x86_64", family: "mac"

初期環境構築


~/.m2/settings.xmlMavenの設定ファイルを作成
以下の記述はチュートリアルからもってきました。

<settings>
<pluginGroups>
<pluginGroup>org.jenkins-ci.tools</pluginGroup>
</pluginGroups>

<profiles>
<!-- Give access to Jenkins plugins -->
<profile>
<id>jenkins</id>
<activation>
<activeByDefault>true</activeByDefault> <!-- change this to false, if you don't like to have it on per default -->
</activation>
<repositories>
<repository>
<id>maven.jenkins-ci.org</id>
<url>http://maven.jenkins-ci.org/content/groups/artifacts/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>maven.jenkins-ci.org</id>
<url>http://maven.jenkins-ci.org/content/groups/artifacts/</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>


次に任意のディレクトリを作成して、プラグイン作成用のコマンドを実行
$ mvn -cpu hpi:create
[WARNING] Command line option -cpu is deprecated and will be removed in future Maven versions.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-hpi-plugin:1.93:create (default-cli) @ standalone-pom ---
[INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[INFO] Setting property: velocimacro.messages.on => 'false'.
[INFO] Setting property: resource.loader => 'classpath'.
[INFO] Setting property: resource.manager.logwhenfound => 'false'.
[INFO] **************************************************************
[INFO] Starting Jakarta Velocity v1.4
[INFO] RuntimeInstance initializing.
[INFO] Default Properties File: org/apache/velocity/runtime/defaults/velocity.properties
[INFO] Default ResourceManager initializing. (class org.apache.velocity.runtime.resource.ResourceManagerImpl)
[INFO] Resource Loader Instantiated: org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader
[INFO] ClasspathResourceLoader : initialization starting.
[INFO] ClasspathResourceLoader : initialization complete.
[INFO] ResourceCache : initialized. (class org.apache.velocity.runtime.resource.ResourceCacheImpl)
[INFO] Default ResourceManager initialization complete.
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Literal
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Macro
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Parse
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Include
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
[INFO] Created: 20 parsers.
[INFO] Velocimacro : initialization starting.
[INFO] Velocimacro : adding VMs from VM library template : VM_global_library.vm
[ERROR] ResourceManager : unable to find resource 'VM_global_library.vm' in any resource loader.
[INFO] Velocimacro : error using VM library template VM_global_library.vm : org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'VM_global_library.vm'
[INFO] Velocimacro : VM library template macro registration complete.
[INFO] Velocimacro : allowInline = true : VMs can be defined inline in templates
[INFO] Velocimacro : allowInlineToOverride = false : VMs defined inline may NOT replace previous VM definitions
[INFO] Velocimacro : allowInlineLocal = false : VMs defined inline will be global in scope if allowed.
[INFO] Velocimacro : initialization complete.
[INFO] Velocity successfully started.
Enter the groupId of your plugin [org.jenkins-ci.plugins]: org.example
[INFO] Defaulting package to group ID + artifact ID: org.example.null
Enter the artifactId of your plugin (normally without '-plugin' suffix): sample
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating Archetype: maven-hpi-plugin:1.93
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: org.example
[INFO] Parameter: package, Value: org.example.null
[INFO] Parameter: artifactId, Value: sample
[INFO] Parameter: basedir, Value: /Users/typosterr/Development/Jenkins_Plugin
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] ********************* End of debug info from resources from generated POM ***********************
[INFO] Archetype created in dir: /Users/typosterr/Development/Jenkins_Plugin/sample
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 59.939s
[INFO] Finished at: Sun Feb 03 18:26:09 JST 2013
[INFO] Final Memory: 8M/81M
[INFO] ------------------------------------------------------------------------

実行後は、以下のように生成されます。 
$ tree
.
├── pom.xml
└── src
└── main
├── java
│   └── org
│   └── example
│   └── null
│   └── HelloWorldBuilder.java
└── resources
├── index.jelly
└── org
└── example
└── null
└── HelloWorldBuilder
├── config.jelly
├── global.jelly
├── help-name.html
└── help-useFrench.html

追記


上記のようにnullというディレクトリが生成されている。
最初は、仕様かと思ったのですが、これが原因でうまく動きませんでした。
なので、以下のように修正

$ tree
.
├── pom.xml
└── src
└── main
├── java
│   └── org
│   └── example
│   └── HelloWorldBuilder.java
└── resources
├── index.jelly
└── org
└── example
└── HelloWorldBuilder
├── config.jelly
├── global.jelly
├── help-name.html
└── help-useFrench.html

また、HelloWorldBuilder.javaを修正
こちらもnullを削除します。

## package名はplugin任意のplugin名なので、環境によって違います。
(前) package org.example.null;
(後) package org.example;

ではプラグインを作成していきます。
$ cd "作成したプラグイン名" 
$ mvn package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building sample 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-hpi-plugin:1.74:validate (default-validate) @ sample ---
[INFO]
[INFO] --- maven-enforcer-plugin:1.0.1:display-info (default) @ sample ---
[INFO] Maven Version: 3.0.4
[INFO] JDK Version: 1.6.0_37 normalized as: 1.6.0-37
[INFO] OS Info: Arch: x86_64 Family: mac Name: mac os x Version: 10.8.2
[INFO]
[INFO] --- maven-localizer-plugin:1.13:generate (default) @ sample ---
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ sample ---
[debug] execute contextualize
[WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 5 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ sample ---
[WARNING] File encoding has not been set, using platform encoding MacRoman, i.e. build is platform dependent!
[INFO] Compiling 1 source file to /Users/typosterr/Development/Jenkins_Plugin/sample/target/classes
[INFO]
[INFO] --- access-modifier-checker:1.3:enforce (default-enforce) @ sample ---
[INFO]
[INFO] --- maven-hpi-plugin:1.74:insert-test (default-insert-test) @ sample ---
[INFO]
[INFO] --- gmaven-plugin:1.3:generateTestStubs (test-in-groovy) @ sample ---
[INFO] No sources found for Java stub generation
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ sample ---
[debug] execute contextualize
[WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/typosterr/Development/Jenkins_Plugin/sample/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ sample ---
[WARNING] File encoding has not been set, using platform encoding MacRoman, i.e. build is platform dependent!
[INFO] Compiling 1 source file to /Users/typosterr/Development/Jenkins_Plugin/sample/target/test-classes
[INFO]
[INFO] --- maven-hpi-plugin:1.74:test-hpl (default-test-hpl) @ sample ---
[INFO] Generating /Users/typosterr/Development/Jenkins_Plugin/sample/target/test-classes/the.hpl
[INFO]
[INFO] --- maven-hpi-plugin:1.74:resolve-test-dependencies (default-resolve-test-dependencies) @ sample ---
[INFO]
[INFO] --- gmaven-plugin:1.3:testCompile (test-in-groovy) @ sample ---
[INFO] No sources found to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.9:test (default-test) @ sample ---
[INFO] Surefire report directory: /Users/typosterr/Development/Jenkins_Plugin/sample/target/surefire-reports

-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running InjectedTest
Exploding jenkins.war at /Users/typosterr/.m2/repository/org/jenkins-ci/main/jenkins-war/1.466/jenkins-war-1.466-war-for-test.jar
Feb 3, 2013 6:38:34 PM org.mortbay.log.Slf4jLog info
INFO: Logging to org.slf4j.impl.JDK14LoggerAdapter(org.mortbay.log) via org.mortbay.log.Slf4jLog
Feb 3, 2013 6:38:34 PM org.mortbay.log.Slf4jLog info
INFO: jetty-6.1.26
Feb 3, 2013 6:38:34 PM org.mortbay.log.Slf4jLog info
INFO: NO JSP Support for , did not find org.apache.jasper.servlet.JspServlet
Feb 3, 2013 6:38:34 PM org.mortbay.log.Slf4jLog info
INFO: Started SocketConnector@0.0.0.0:57173
Feb 3, 2013 6:38:34 PM jenkins.InitReactorRunner$1 onAttained
INFO: Started initialization
Feb 3, 2013 6:38:35 PM jenkins.InitReactorRunner$1 onAttained
INFO: Listed all plugins
Feb 3, 2013 6:38:35 PM jenkins.InitReactorRunner$1 onAttained
INFO: Prepared all plugins
Feb 3, 2013 6:38:35 PM jenkins.InitReactorRunner$1 onAttained
INFO: Started all plugins
Feb 3, 2013 6:38:35 PM jenkins.InitReactorRunner$1 onAttained
INFO: Augmented all extensions
Feb 3, 2013 6:38:35 PM jenkins.InitReactorRunner$1 onAttained
INFO: Loaded all jobs
Feb 3, 2013 6:38:38 PM jenkins.InitReactorRunner$1 onAttained
INFO: Completed initialization
Feb 3, 2013 6:38:38 PM hudson.TcpSlaveAgentListener <init>
INFO: JNLP slave agent listener started on TCP port 57175
Feb 3, 2013 6:38:38 PM org.mortbay.log.Slf4jLog info
INFO: jetty-6.1.26
Feb 3, 2013 6:38:38 PM org.mortbay.log.Slf4jLog info
INFO: Started SocketConnector@0.0.0.0:57176
Feb 3, 2013 6:38:39 PM org.mortbay.log.Slf4jLog info
INFO: Stopped SocketConnector@0.0.0.0:57173
Feb 3, 2013 6:38:39 PM hudson.PluginWrapper stop
INFO: Stopping ant
Feb 3, 2013 6:38:39 PM hudson.PluginWrapper stop
INFO: Stopping javadoc
Feb 3, 2013 6:38:39 PM hudson.PluginWrapper stop
INFO: Stopping cvs
Feb 3, 2013 6:38:39 PM hudson.PluginWrapper stop
INFO: Stopping maven-plugin
Feb 3, 2013 6:38:39 PM hudson.PluginWrapper stop
INFO: Stopping ssh-slaves
Feb 3, 2013 6:38:39 PM hudson.PluginWrapper stop
INFO: Stopping subversion
Feb 3, 2013 6:38:39 PM hudson.PluginWrapper stop
INFO: Stopping translation
Feb 3, 2013 6:38:39 PM hudson.PluginWrapper stop
INFO: Stopping ui-samples-plugin
Feb 3, 2013 6:38:39 PM hudson.PluginWrapper stop
INFO: Stopping sample
Feb 3, 2013 6:38:39 PM org.mortbay.log.Slf4jLog info
INFO: jetty-6.1.26
Feb 3, 2013 6:38:39 PM org.mortbay.log.Slf4jLog info
INFO: NO JSP Support for , did not find org.apache.jasper.servlet.JspServlet
Feb 3, 2013 6:38:39 PM org.mortbay.log.Slf4jLog info
INFO: Started SocketConnector@0.0.0.0:57178
Feb 3, 2013 6:38:39 PM jenkins.InitReactorRunner$1 onAttained
INFO: Started initialization
Feb 3, 2013 6:38:39 PM jenkins.InitReactorRunner$1 onAttained
INFO: Listed all plugins
Feb 3, 2013 6:38:39 PM jenkins.InitReactorRunner$1 onAttained
INFO: Prepared all plugins
Feb 3, 2013 6:38:39 PM jenkins.InitReactorRunner$1 onAttained
INFO: Started all plugins
Feb 3, 2013 6:38:39 PM jenkins.InitReactorRunner$1 onAttained
INFO: Augmented all extensions
Feb 3, 2013 6:38:39 PM jenkins.InitReactorRunner$1 onAttained
INFO: Loaded all jobs
Feb 3, 2013 6:38:40 PM jenkins.InitReactorRunner$1 onAttained
INFO: Completed initialization
Feb 3, 2013 6:38:40 PM hudson.TcpSlaveAgentListener <init>
INFO: JNLP slave agent listener started on TCP port 57179
=== Starting CliSanityTest.testCliSanity
Feb 3, 2013 6:38:41 PM org.mortbay.log.Slf4jLog info
INFO: Stopped SocketConnector@0.0.0.0:57178
Feb 3, 2013 6:38:41 PM hudson.PluginWrapper stop
INFO: Stopping ant
Feb 3, 2013 6:38:41 PM hudson.PluginWrapper stop
INFO: Stopping javadoc
Feb 3, 2013 6:38:41 PM hudson.PluginWrapper stop
INFO: Stopping cvs
Feb 3, 2013 6:38:41 PM hudson.PluginWrapper stop
INFO: Stopping maven-plugin
Feb 3, 2013 6:38:41 PM hudson.PluginWrapper stop
INFO: Stopping ssh-slaves
Feb 3, 2013 6:38:41 PM hudson.PluginWrapper stop
INFO: Stopping subversion
Feb 3, 2013 6:38:41 PM hudson.PluginWrapper stop
INFO: Stopping translation
Feb 3, 2013 6:38:41 PM hudson.PluginWrapper stop
INFO: Stopping ui-samples-plugin
Feb 3, 2013 6:38:41 PM hudson.PluginWrapper stop
INFO: Stopping sample
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 10.066 sec

Results :

Tests run: 7, Failures: 0, Errors: 0, Skipped: 0

[INFO]
[INFO] --- maven-license-plugin:1.4:process (default) @ sample ---
[INFO] Generated /Users/typosterr/Development/Jenkins_Plugin/sample/target/sample/WEB-INF/licenses.xml
[INFO]
[INFO] --- maven-hpi-plugin:1.74:hpi (default-hpi) @ sample ---
[INFO] Exploding webapp...
[INFO] Copy webapp webResources to /Users/typosterr/Development/Jenkins_Plugin/sample/target/sample
[INFO] Assembling webapp sample in /Users/typosterr/Development/Jenkins_Plugin/sample/target/sample
[INFO] Generating hpi /Users/typosterr/Development/Jenkins_Plugin/sample/target/sample.hpi
[INFO] Generating /Users/typosterr/Development/Jenkins_Plugin/sample/target/sample/META-INF/MANIFEST.MF
[INFO] Building jar: /Users/typosterr/Development/Jenkins_Plugin/sample/target/sample.hpi
[INFO] Building jar: /Users/typosterr/Development/Jenkins_Plugin/sample/target/sample.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 20.102s
[INFO] Finished at: Sun Feb 03 18:38:43 JST 2013
[INFO] Final Memory: 28M/81M
[INFO] ------------------------------------------------------------------------


targetというディレクトリがつくられ、いろいろ生成されます。
詳細はこんな感じになります。
以下の処理はいらないと思います。
$  mvn install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building sample 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-hpi-plugin:1.74:validate (default-validate) @ sample ---
[INFO]
[INFO] --- maven-enforcer-plugin:1.0.1:display-info (default) @ sample ---
[INFO] Maven Version: 3.0.4
[INFO] JDK Version: 1.6.0_37 normalized as: 1.6.0-37
[INFO] OS Info: Arch: x86_64 Family: mac Name: mac os x Version: 10.8.2
[INFO]
[INFO] --- maven-localizer-plugin:1.13:generate (default) @ sample ---
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ sample ---
[debug] execute contextualize
[WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 5 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ sample ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- access-modifier-checker:1.3:enforce (default-enforce) @ sample ---
[INFO]
[INFO] --- maven-hpi-plugin:1.74:insert-test (default-insert-test) @ sample ---
[INFO]
[INFO] --- gmaven-plugin:1.3:generateTestStubs (test-in-groovy) @ sample ---
[INFO] No sources found for Java stub generation
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ sample ---
[debug] execute contextualize
[WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/typosterr/Development/Jenkins_Plugin/sample/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ sample ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-hpi-plugin:1.74:test-hpl (default-test-hpl) @ sample ---
[INFO] Generating /Users/typosterr/Development/Jenkins_Plugin/sample/target/test-classes/the.hpl
[INFO]
[INFO] --- maven-hpi-plugin:1.74:resolve-test-dependencies (default-resolve-test-dependencies) @ sample ---
[INFO]
[INFO] --- gmaven-plugin:1.3:testCompile (test-in-groovy) @ sample ---
[INFO] No sources found to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.9:test (default-test) @ sample ---
[INFO] Surefire report directory: /Users/typosterr/Development/Jenkins_Plugin/sample/target/surefire-reports

-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running InjectedTest
Picking up existing exploded jenkins.war at /Users/typosterr/Development/Jenkins_Plugin/sample/./target/jenkins-for-test
Feb 3, 2013 10:31:57 PM org.mortbay.log.Slf4jLog info
INFO: Logging to org.slf4j.impl.JDK14LoggerAdapter(org.mortbay.log) via org.mortbay.log.Slf4jLog
Feb 3, 2013 10:31:57 PM org.mortbay.log.Slf4jLog info
INFO: jetty-6.1.26
Feb 3, 2013 10:31:57 PM org.mortbay.log.Slf4jLog info
INFO: NO JSP Support for , did not find org.apache.jasper.servlet.JspServlet
Feb 3, 2013 10:31:57 PM org.mortbay.log.Slf4jLog info
INFO: Started SocketConnector@0.0.0.0:50778
Feb 3, 2013 10:31:57 PM jenkins.InitReactorRunner$1 onAttained
INFO: Started initialization
Feb 3, 2013 10:31:58 PM jenkins.InitReactorRunner$1 onAttained
INFO: Listed all plugins
Feb 3, 2013 10:31:58 PM jenkins.InitReactorRunner$1 onAttained
INFO: Prepared all plugins
Feb 3, 2013 10:31:58 PM jenkins.InitReactorRunner$1 onAttained
INFO: Started all plugins
Feb 3, 2013 10:31:58 PM jenkins.InitReactorRunner$1 onAttained
INFO: Augmented all extensions
Feb 3, 2013 10:31:58 PM jenkins.InitReactorRunner$1 onAttained
INFO: Loaded all jobs
Feb 3, 2013 10:32:01 PM jenkins.InitReactorRunner$1 onAttained
INFO: Completed initialization
Feb 3, 2013 10:32:01 PM hudson.TcpSlaveAgentListener <init>
INFO: JNLP slave agent listener started on TCP port 50780
Feb 3, 2013 10:32:02 PM org.mortbay.log.Slf4jLog info
INFO: jetty-6.1.26
Feb 3, 2013 10:32:02 PM org.mortbay.log.Slf4jLog info
INFO: Started SocketConnector@0.0.0.0:50781
Feb 3, 2013 10:32:03 PM org.mortbay.log.Slf4jLog info
INFO: Stopped SocketConnector@0.0.0.0:50778
Feb 3, 2013 10:32:03 PM hudson.PluginWrapper stop
INFO: Stopping ant
Feb 3, 2013 10:32:03 PM hudson.PluginWrapper stop
INFO: Stopping javadoc
Feb 3, 2013 10:32:03 PM hudson.PluginWrapper stop
INFO: Stopping cvs
Feb 3, 2013 10:32:03 PM hudson.PluginWrapper stop
INFO: Stopping maven-plugin
Feb 3, 2013 10:32:03 PM hudson.PluginWrapper stop
INFO: Stopping ssh-slaves
Feb 3, 2013 10:32:03 PM hudson.PluginWrapper stop
INFO: Stopping subversion
Feb 3, 2013 10:32:03 PM hudson.PluginWrapper stop
INFO: Stopping translation
Feb 3, 2013 10:32:03 PM hudson.PluginWrapper stop
INFO: Stopping ui-samples-plugin
Feb 3, 2013 10:32:03 PM hudson.PluginWrapper stop
INFO: Stopping sample
Feb 3, 2013 10:32:03 PM org.mortbay.log.Slf4jLog info
INFO: jetty-6.1.26
Feb 3, 2013 10:32:03 PM org.mortbay.log.Slf4jLog info
INFO: NO JSP Support for , did not find org.apache.jasper.servlet.JspServlet
Feb 3, 2013 10:32:03 PM org.mortbay.log.Slf4jLog info
INFO: Started SocketConnector@0.0.0.0:50783
Feb 3, 2013 10:32:03 PM jenkins.InitReactorRunner$1 onAttained
INFO: Started initialization
Feb 3, 2013 10:32:03 PM jenkins.InitReactorRunner$1 onAttained
INFO: Listed all plugins
Feb 3, 2013 10:32:03 PM jenkins.InitReactorRunner$1 onAttained
INFO: Prepared all plugins
Feb 3, 2013 10:32:03 PM jenkins.InitReactorRunner$1 onAttained
INFO: Started all plugins
Feb 3, 2013 10:32:03 PM jenkins.InitReactorRunner$1 onAttained
INFO: Augmented all extensions
Feb 3, 2013 10:32:03 PM jenkins.InitReactorRunner$1 onAttained
INFO: Loaded all jobs
Feb 3, 2013 10:32:03 PM jenkins.InitReactorRunner$1 onAttained
INFO: Completed initialization
Feb 3, 2013 10:32:03 PM hudson.TcpSlaveAgentListener <init>
INFO: JNLP slave agent listener started on TCP port 50785
=== Starting CliSanityTest.testCliSanity
Feb 3, 2013 10:32:03 PM org.mortbay.log.Slf4jLog info
INFO: Stopped SocketConnector@0.0.0.0:50783
Feb 3, 2013 10:32:03 PM hudson.PluginWrapper stop
INFO: Stopping ant
Feb 3, 2013 10:32:03 PM hudson.PluginWrapper stop
INFO: Stopping javadoc
Feb 3, 2013 10:32:03 PM hudson.PluginWrapper stop
INFO: Stopping cvs
Feb 3, 2013 10:32:03 PM hudson.PluginWrapper stop
INFO: Stopping maven-plugin
Feb 3, 2013 10:32:03 PM hudson.PluginWrapper stop
INFO: Stopping ssh-slaves
Feb 3, 2013 10:32:03 PM hudson.PluginWrapper stop
INFO: Stopping subversion
Feb 3, 2013 10:32:03 PM hudson.PluginWrapper stop
INFO: Stopping translation
Feb 3, 2013 10:32:03 PM hudson.PluginWrapper stop
INFO: Stopping ui-samples-plugin
Feb 3, 2013 10:32:03 PM hudson.PluginWrapper stop
INFO: Stopping sample
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 7.316 sec

Results :

Tests run: 5, Failures: 0, Errors: 0, Skipped: 0

[INFO]
[INFO] --- maven-license-plugin:1.4:process (default) @ sample ---
[INFO] Generated /Users/typosterr/Development/Jenkins_Plugin/sample/target/sample/WEB-INF/licenses.xml
[INFO]
[INFO] --- maven-hpi-plugin:1.74:hpi (default-hpi) @ sample ---
[INFO] Exploding webapp...
[INFO] Copy webapp webResources to /Users/typosterr/Development/Jenkins_Plugin/sample/target/sample
[INFO] Assembling webapp sample in /Users/typosterr/Development/Jenkins_Plugin/sample/target/sample
[INFO] Generating hpi /Users/typosterr/Development/Jenkins_Plugin/sample/target/sample.hpi
[INFO] Generating /Users/typosterr/Development/Jenkins_Plugin/sample/target/sample/META-INF/MANIFEST.MF
[INFO] Building jar: /Users/typosterr/Development/Jenkins_Plugin/sample/target/sample.hpi
[INFO] Building jar: /Users/typosterr/Development/Jenkins_Plugin/sample/target/sample.jar
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ sample ---
[INFO] Installing /Users/typosterr/Development/Jenkins_Plugin/sample/target/sample.hpi to /Users/typosterr/.m2/repository/org/example/sample/1.0-SNAPSHOT/sample-1.0-SNAPSHOT.hpi
[INFO] Installing /Users/typosterr/Development/Jenkins_Plugin/sample/pom.xml to /Users/typosterr/.m2/repository/org/example/sample/1.0-SNAPSHOT/sample-1.0-SNAPSHOT.pom
[INFO] Installing /Users/typosterr/Development/Jenkins_Plugin/sample/target/sample.jar to /Users/typosterr/.m2/repository/org/example/sample/1.0-SNAPSHOT/sample-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.615s
[INFO] Finished at: Sun Feb 03 22:32:05 JST 2013
[INFO] Final Memory: 17M/81M
[INFO] ------------------------------------------------------------------------


~/.m2/repository/にhpiとjarがコピーされました。 これによってなにが出来るようになったのかは、わかりません。
プラグインのデバッグは、以下のコマンドを実行することによって、デバッグ用のJenkinsがたちあがります。
また、プラグインを既存のJenkinsのプラグインをして、インストールすることもできます。
今回は、デバッグ用のJenkinsを立ち上げる方法でやってみます。
$ export MAVEN_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=n"
$ mvn hpi:run
Listening for transport dt_socket at address: 8000
[INFO] Scanning for projects...
Downloading: http://repo.jenkins-ci.org/public/org/kohsuke/access-modifier-checker/maven-metadata.xml
Downloaded: http://repo.jenkins-ci.org/public/org/kohsuke/access-modifier-checker/maven-metadata.xml (389 B at 0.3 KB/sec)
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building sample 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-hpi-plugin:1.74:run (default-cli) @ sample >>>
Downloading: http://repo.maven.apache.org/maven2/org/kohsuke/stapler/stapler/maven-metadata.xml
Downloading: http://repo.jenkins-ci.org/public/org/kohsuke/stapler/stapler/maven-metadata.xml
Downloaded: http://repo.maven.apache.org/maven2/org/kohsuke/stapler/stapler/maven-metadata.xml (333 B at 0.4 KB/sec)
Downloaded: http://repo.jenkins-ci.org/public/org/kohsuke/stapler/stapler/maven-metadata.xml (6 KB at 4.7 KB/sec)
[INFO]
[INFO] --- maven-hpi-plugin:1.74:validate (default-validate) @ sample ---
[INFO]
[INFO] --- maven-enforcer-plugin:1.0.1:display-info (default) @ sample ---
[INFO] Maven Version: 3.0.4
[INFO] JDK Version: 1.6.0_37 normalized as: 1.6.0-37
[INFO] OS Info: Arch: x86_64 Family: mac Name: mac os x Version: 10.8.2
[INFO]
[INFO] --- maven-localizer-plugin:1.13:generate (default) @ sample ---
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ sample ---
[debug] execute contextualize
[WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 5 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ sample ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< maven-hpi-plugin:1.74:run (default-cli) @ sample <<<
[INFO]
[INFO] --- maven-hpi-plugin:1.74:run (default-cli) @ sample ---
[INFO] Generating ./work/plugins/sample.hpl
[INFO] Copying dependency Jenkins plugin /Users/typosterr/.m2/repository/org/jenkins-ci/plugins/ant/1.1/ant-1.1.jar
[INFO] Copying dependency Jenkins plugin /Users/typosterr/.m2/repository/org/jenkins-ci/main/maven-plugin/1.466/maven-plugin-1.466.jar
[INFO] Copying dependency Jenkins plugin /Users/typosterr/.m2/repository/org/jenkins-ci/main/ui-samples-plugin/1.466/ui-samples-plugin-1.466.jar
[INFO] Copying dependency Jenkins plugin /Users/typosterr/.m2/repository/org/jenkins-ci/plugins/subversion/1.26/subversion-1.26.jar
[INFO] Copying dependency Jenkins plugin /Users/typosterr/.m2/repository/org/jenkins-ci/plugins/javadoc/1.0/javadoc-1.0.jar
[INFO] Configuring Jetty for project: sample
2013-02-04 00:11:10.399::INFO: Logging to STDERR via org.mortbay.log.StdErrLog
[INFO] Context path = /
[INFO] Tmp directory = /Users/typosterr/Development/Jenkins_Plugin/sample/target/work
[INFO] Web defaults = jetty default
[INFO] Starting jetty 6.1.1 ...
2013-02-04 00:11:10.565::INFO: jetty-6.1.1
2013-02-04 00:11:10.586::INFO: Extract jar:file:/Users/typosterr/.m2/repository/org/jenkins-ci/main/jenkins-war/1.466/jenkins-war-1.466.war!/ to /Users/typosterr/Development/Jenkins_Plugin/sample/target/work/webapp
Jenkins home directory: /Users/typosterr/Development/Jenkins_Plugin/sample/./work found at: System.getProperty("HUDSON_HOME")
2013-02-04 00:11:13.875::INFO: Started SelectChannelConnector @ 0.0.0.0:8080
[INFO] Started Jetty Server
[INFO] Console reloading is ENABLED. Hit ENTER on the console to restart the context.
2013/02/04 0:11:13 jenkins.InitReactorRunner$1 onAttained
??: Started initialization
2013/02/04 0:11:14 jenkins.InitReactorRunner$1 onAttained
??: Listed all plugins
2013/02/04 0:11:15 jenkins.InitReactorRunner$1 onAttained
??: Prepared all plugins
2013/02/04 0:11:15 jenkins.InitReactorRunner$1 onAttained
??: Started all plugins
2013/02/04 0:11:15 jenkins.InitReactorRunner$1 onAttained
??: Augmented all extensions
2013/02/04 0:11:15 jenkins.InitReactorRunner$1 onAttained
??: Loaded all jobs
2013/02/04 0:11:17 org.apache.sshd.common.util.SecurityUtils$BouncyCastleRegistration run
??: Trying to register BouncyCastle as a JCE provider
2013/02/04 0:11:17 org.apache.sshd.common.util.SecurityUtils$BouncyCastleRegistration run
??: Registration succeeded
2013/02/04 0:11:18 org.jenkinsci.main.modules.sshd.SSHD start
??: Started SSHD at port 52607
2013/02/04 0:11:18 jenkins.InitReactorRunner$1 onAttained
??: Completed initialization
2013/02/04 0:11:18 hudson.TcpSlaveAgentListener <init>
??: JNLP slave agent listener started on TCP port 52608
2013/02/04 0:11:18 hudson.WebAppMain$2 run
??: Jenkins is fully up and running

ここで罠としては、Port番号が8000となっていますが、8080でないと見れない事です。
ブラウザでアクセスしてみます。
そうすると、以下のように表示されます。

いつも見ているのとはちょっと違った感じです。
それでは早速、プラグインを確認してみましょう。

ここで、先ほど作ったプラグインがインストールされていることが確認できます。
つぎに、このプラグインを使ってJOBを作成していきましょう。

sampleという名前でJOBを作成しました。
では、今回作ったプラグインの設定です。

BuildからSay hello worldを選択します。

nameと書かれたテキストフィールドに好きな文字列を入力します。

設定できたら、JOBを実行(ビルド)してみましょう。

うまくいったようなので、コンソールのログを確認してみましょう。

うまくいったみたいです。
引き続き、調査していきたいと思います。

最後までお読みいただき、ありがとうございました。