プラグインをHudsonに含めて配布する
Hudson 1.259から、hudson.warにあらかじめプラグインを同梱して配布することができるようになりました。
この機能を使えば、Hudsonをプロジェクトに導入する際に、動作確認をしたプラグインを含んだhudson.warを提供するだけになるので、ダウンロードの手間を省けますし、余計なトラブルを回避できそうです。
Bundling plugins with Hudson
http://hudson.gotdns.com/wiki/display/HUDSON/Bundling+plugins+with+Hudson
に書いてある通り、hudson.warのWEB-INF/pluginsにプラグイン*.hpiを入れるだけです。
ここで1つ問題があります。hudson.warは署名がされているので、そのままだと起動時にSecurityExceptionが発生してしまいます。
再度署名するのも手間ですので、署名をはずすようにすると無事起動しました。
手抜きですが、Antのbuild.xmlは以下のような感じです。
<?xml version="1.0" ?> <project name="plugins pre-installed in hudwon.war" default="package" basedir="."> <!-- build.xmlと同じディレクトリにhudson.war pluginsディレクトリに同梱するプラグインを入れておく --> <property name="dir.plugins" value="plugins" /> <property name="dir.tmp" value="tmp" /> <property name="dir.war.plugins" value="${dir.tmp}/WEB-INF/plugins" /> <target name="prepare"> <copy file="hudson.war" tofile="hudson.war.org" preservelastmodified="true" /> <delete dir="${dir.tmp}" /> <mkdir dir="${dir.tmp}" /> </target> <target name="package" depends="prepare"> <unjar src="hudson.war" dest="${dir.tmp}" /> <delete dir="${dir.war.plugins}" /> <mkdir dir="${dir.war.plugins}" /> <copy todir="${dir.war.plugins}" > <fileset dir="${dir.plugins}"> <include name="*.hpi" /> </fileset> </copy> <jar destfile="hudson.war"> <fileset dir="${dir.tmp}"> <!-- 署名に関するファイルは含めない --> <exclude name="META-INF/HUDSON.*" /> </fileset> <manifest> <attribute name="Main-Class" value="Main" /> </manifest> </jar> </target> </project>
後は、配布元が分かるようにHudsonの画面の下に出てくるバージョン表示を少し変えたいところですが、今日はここまで。