【问题标题】:Failure to find org.jenkins-ci.plugins:plugin:pom:2.11 in https://repo.maven.apache.org/maven2在 https://repo.maven.apache.org/maven2 中找不到 org.jenkins-ci.plugins:plugin:pom:2.11
【发布时间】:2017-04-29 00:03:33
【问题描述】:

我正在尝试编译一个 Maven 项目,该项目旨在用作 Jenkins 插件。运行“mvn package”命令时,我收到下面列出的错误。有什么办法可以解决这个问题?

TIA

看到这个: https://mvnrepository.com/artifact/org.apache.maven/maven-plugin-api/3.5.0 并取出将 Maven 插件定义为“父级”的部分,并将其设为“依赖项”

然后我开始收到如下错误:“未知包装:hpi @ line 12, column 13”

然后我看到了以下内容: Jenkins plug-in developing - Maven issue: Unknown packaging: hpi 它说 => “另外,将详细信息添加到您的 .m2/settings.xml 中,如本教程顶部所示,以允许使用短名称“hpi”。”

更改 settings.xml 后(根据链接)仍然不断收到“未知包装...”错误

然后我又回到了包附带的原始 pom.xml 文件。

pom.xml 文件如下:

这一次,在使用它之后,似乎任何/所有与 Jenkins 相关的 jar 文件都已下载(这需要一些时间)。 “hpi”错误已消失,但已替换为新错误

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running InjectedTest
Tests run: 18, Failures: 3, Errors: 12, Skipped: 0, Time elapsed: 60.722 sec <<< FAILURE! - in InjectedTest
edu\utah\med\ped\WaveMakerDeployer\config.jelly(org.jvnet.hudson.test.JellyTestSuiteBuilder$JellyCheck)  Time elapsed: 0.338 sec  <<< FAILURE!
java.lang.AssertionError: <?jelly escape-by-default='true'?> is missing in file:/C:/WORK/Development/JENKINS/WaveMakerJenkinsDeployer/target/classes/edu/utah/med/ped/WaveMakerDeployer/config.jelly
        at org.jvnet.hudson.test.JellyTestSuiteBuilder$JellyCheck.runTest(JellyTestSuiteBuilder.java:108)

edu\utah\med\ped\WaveMakerDeployer\global.jelly(org.jvnet.hudson.test.JellyTestSuiteBuilder$JellyCheck)  Time elapsed: 0.086 sec  <<< FAILURE!
java.lang.AssertionError: <?jelly escape-by-default='true'?> is missing in file:/C:/WORK/Development/JENKINS/WaveMakerJenkinsDeployer/target/classes/edu/utah/med/ped/WaveMakerDeployer/global.jelly
        at org.jvnet.hudson.test.JellyTestSuiteBuilder$JellyCheck.runTest(JellyTestSuiteBuilder.java:108)

index.jelly(org.jvnet.hudson.test.JellyTestSuiteBuilder$JellyCheck)  Time elapsed: 0.019 sec  <<< FAILURE!
java.lang.AssertionError: <?jelly escape-by-default='true'?> is missing in file:/C:/WORK/Development/JENKINS/WaveMakerJenkinsDeployer/target/classes/index.jelly
        at org.jvnet.hudson.test.JellyTestSuiteBuilder$JellyCheck.runTest(JellyTestSuiteBuilder.java:108)

initializationError(org.junit.runner.manipulation.Filter)  Time elapsed: 0 sec  <<< ERROR!
java.lang.Exception: No tests found matching Method index.jelly(org.jvnet.hudson.test.JellyTestSuiteBuilder$JellyCheck) from org.junit.internal.requests.ClassRequest@450f78c9

initializationError(org.junit.runner.manipulation.Filter)  Time elapsed: 0 sec  <<< ERROR!
java.lang.Exception: No tests found matching Method edu\utah\med\ped\WaveMakerDeployer\config.jelly(org.jvnet.hudson.test.JellyTestSuiteBuilder$JellyCheck) from org.junit.internal.requests.ClassRequest@4877102b

initializationError(org.junit.runner.manipulation.Filter)  Time elapsed: 0.001 sec  <<< ERROR!
java.lang.Exception: No tests found matching Method edu\utah\med\ped\WaveMakerDeployer\global.jelly(org.jvnet.hudson.test.JellyTestSuiteBuilder$JellyCheck) from org.junit.internal.requests.ClassRequest@c69c38

initializationError(org.junit.runner.manipulation.Filter)  Time elapsed: 0.001 sec  <<< ERROR!
java.lang.Exception: No runnable methods

initializationError(org.junit.runner.manipulation.Filter)  Time elapsed: 0 sec  <<< ERROR!
java.lang.Exception: No runnable methods

initializationError(org.junit.runner.manipulation.Filter)  Time elapsed: 0 sec  <<< ERROR!
java.lang.Exception: No runnable methods

initializationError(org.junit.runner.manipulation.Filter)  Time elapsed: 0 sec  <<< ERROR!
java.lang.Exception: No runnable methods

initializationError(org.junit.runner.manipulation.Filter)  Time elapsed: 0.001 sec  <<< ERROR!
java.lang.Exception: No runnable methods

initializationError(org.junit.runner.manipulation.Filter)  Time elapsed: 0 sec  <<< ERROR!
java.lang.Exception: No runnable methods

initializationError(org.junit.runner.manipulation.Filter)  Time elapsed: 0 sec  <<< ERROR!
java.lang.Exception: No runnable methods

initializationError(org.junit.runner.manipulation.Filter)  Time elapsed: 0.001 sec  <<< ERROR!
java.lang.Exception: No runnable methods

initializationError(org.junit.runner.manipulation.Filter)  Time elapsed: 0.001 sec  <<< ERROR!
java.lang.Exception: No runnable methods


Results :

Failed tests:
  JellyTestSuiteBuilder$JellyCheck.runTest:108 <?jelly escape-by-default='true'?> is missing in file:/C:/WORK/Development/JENKINS/WaveMakerJenkinsDeployer/target/classes/edu/utah/med/ped/WaveMakerDeployer/config.jelly
  JellyTestSuiteBuilder$JellyCheck.runTest:108 <?jelly escape-by-default='true'?> is missing in file:/C:/WORK/Development/JENKINS/WaveMakerJenkinsDeployer/target/classes/edu/utah/med/ped/WaveMakerDeployer/global.jelly
  JellyTestSuiteBuilder$JellyCheck.runTest:108 <?jelly escape-by-default='true'?> is missing in file:/C:/WORK/Development/JENKINS/WaveMakerJenkinsDeployer/target/classes/index.jelly
Tests in error:
org.junit.runner.manipulation.Filter.initializationError(org.junit.runner.manipulation.Filter)
  Run 1: Filter.initializationError ▒  No tests found matching Method index.jelly(org.j...
  Run 2: Filter.initializationError ▒  No tests found matching Method edu\utah\med\ped\...
  Run 3: Filter.initializationError ▒  No tests found matching Method edu\utah\med\ped\...
  Run 4: Filter.initializationError ▒  No runnable methods
  Run 5: Filter.initializationError ▒  No runnable methods
  Run 6: Filter.initializationError ▒  No runnable methods
  Run 7: Filter.initializationError ▒  No runnable methods
  Run 8: Filter.initializationError ▒  No runnable methods
  Run 9: Filter.initializationError ▒  No runnable methods
  Run 10: Filter.initializationError ▒  No runnable methods
  Run 11: Filter.initializationError ▒  No runnable methods
  Run 12: Filter.initializationError ▒  No runnable methods

问题:从这里可以去哪里?这些“默认”注入测试有多重要

TIA

【问题讨论】:

    标签: maven jenkins plugins


    【解决方案1】:

    开发jenkins插件时,需要配置maven从repo.jenkins-ci.org查找库。这是一个示例~/.m2/settings.xml

    <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>repo.jenkins-ci.org</id>
              <url>https://repo.jenkins-ci.org/public/</url>
            </repository>
          </repositories>
          <pluginRepositories>
            <pluginRepository>
              <id>repo.jenkins-ci.org</id>
              <url>https://repo.jenkins-ci.org/public/</url>
            </pluginRepository>
          </pluginRepositories>
        </profile>
      </profiles>
      <mirrors>
        <mirror>
          <id>repo.jenkins-ci.org</id>
          <url>https://repo.jenkins-ci.org/public/</url>
          <mirrorOf>m.g.o-public</mirrorOf>
        </mirror>
      </mirrors>
    </settings>
    

    这是来自https://wiki.jenkins-ci.org/display/JENKINS/Plugin+tutorial。请注意,如果您使用的是 nexus,则可以在此处找到特定于 nexus 的替代说明。

    【讨论】:

    • 感谢您的回复。我在这里找到了一个旧线程:stackoverflow.com/questions/9003368/… 这几乎和你说的一样。我相应地对 settings.xml 文件进行了更改。 .java 源文件似乎已经编译,但现在似乎运行了默认注入测试(即使一开始没有创建 JUnit 测试程序)。这些默认测试程序有多​​重要?尝试将此 .hpi 导入 Jenkins 是否仍然可以?
    • 您可以使用插件来处理 jenkins 实例。考虑到您的更改,您可能会很好地判断发生这种情况的可能性。你总是可以启动一个测试 jenkins 实例——也许是 docker——以确保你的插件不会让它着火。 :)
    • >> 你可以使用插件来处理 jenkins 实例。
    • 大声笑——这就是我的想法“你总是可以启动一个测试 jenkins 实例——也许使用 docker——以确保你的插件不会着火”如何一个这样做?什么是“码头工人”?
    • 另外,您对这是什么有任何见解:=> edu\utah\med\ped\WaveMakerDeployer\config.jelly(org.jvnet.hudson.test.JellyTestSuiteBuilder$JellyCheck) 时间经过:0.338 秒 is missing in file:/C:/WORK/Development/JENKINS/WaveMakerJenkinsDeployer/target/classes/edu/utah/med/ped/WaveMakerDeployer /config.jelly at org.jvnet.hudson.test.JellyTestSuiteBuilder$JellyCheck.runTest(JellyTestSuiteBuilder.java:108)
    【解决方案2】:

    burnettk 的回答,除了我使用的是 Gradle,所以对我来说是

    repositories {
        maven {
            url('https://repo.jenkins-ci.org/public/')
        }
    }
    

    我猜,在 Maven 配置中,&lt;pluginRepositories&gt; 子树可以安全地省略。

    【讨论】:

      猜你喜欢
      • 2021-09-20
      • 1970-01-01
      • 2020-06-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-14
      相关资源
      最近更新 更多