【问题标题】:Jenkins plugin development not working with maven 2Jenkins插件开发不适用于maven 2
【发布时间】:2013-03-08 14:23:39
【问题描述】:
我正在尝试让 Jenkins 的 HelloWolrdBuilder 示例工作。遵循tutorial 步骤时一切顺利,但是当我运行 Jenkins 测试示例插件时,插件没有构建步骤,也没有全局配置。然而,在插件管理器中,插件似乎已安装。我注意到在使用 maven 2.2.1 时会发生这种情况,但是当我切换到 maven 3.0.5 时,如here 所述,它工作正常;但是用 maven 3 开发我的插件不是一个选择。关于如何解决这个问题的任何想法?
【问题讨论】:
标签:
maven
jenkins
jenkins-plugins
【解决方案1】:
在尝试了很多不起作用的事情后,我发现this other 教程与 Jenkins 的社区教程非常相似,但具体说明了这一点:
If you are having problems with the latest Plugin version, you can also specify the version of the plugin that you want to use.
$ mvn -cpu org.jenkins-ci.tools:maven-hpi-plugin:1.84:create
这个解决方法成功了,现在一切正常。
编辑:在深入挖掘之后,我在 IRC 频道中询问,我被告知事实上 maven 3 现在需要使用最新版本的 hpi-plugin。
【解决方案2】:
为了让 maven 知道该做什么,你需要将以下 xml 添加到你的主 maven 目录 ($HOME/.m2/settings.xml)
<settings>
<pluginGroups>
<pluginGroup>org.jenkins-ci.tools</pluginGroup>
</pluginGroups>
<profiles>
<profile>
<id>jenkins</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
我从以下渠道获得此信息:
Link to Jenkins-Plug-in Tutorial