Mantis PluginからGit Pluginを参照する
Mantis PluginからGit PluginとかMercurial Pluginを参照する方法のメモ。詳細は、Dependencies among pluginsを参照。
pom.xmlの設定
Mantis Pluginのpom.xmlにdependencyを追加。
<dependency> <groupId>org.jvnet.hudson.plugins</groupId> <artifactId>git</artifactId> <version>0.5</version> <optional>true</optional> </dependency>
これを追加すると、Mantis PluginのMANIFESTに
Manifest-Version: 1.0 Built-By: sogabe Created-By: Apache Maven Build-Jdk: 1.6.0_13 Extension-Name: mantis Specification-Title: Integrates Hudson to Mantis Implementation-Title: mantis Implementation-Version: 0.7.1-SNAPSHOT Plugin-Class: hudson.plugins.mantis.PluginImpl Short-Name: mantis Long-Name: Hudson Mantis plugin Url: http://hudson.gotdns.com/wiki/display/HUDSON/Mantis+Plugin Plugin-Version: 0.7.1-SNAPSHOT (private-04/15/2009 08:50-sogabe) Hudson-Version: 1.299 Plugin-Dependencies: git:0.5;resolution:=optional
のように、Plugin-Dependenciesが追加される。ClassicPluginStrategyがこれを参照して、Pluginのクラスローダーをいじっている。
Mantis Pluginでの実装
Git Pluginを使うところで、
if (Hudson.getInstance().getPlugin("git") != null) { // Gitの処理を行う }
とやればOK。