我将POM文件中的jenkins版本从2.60.3更新为2.76。现在,当我尝试使用命令运行mvn时:
mvn hpi:run
这会导致 BUILD FAILURE ,并出现以下错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-
plugin:1.3.1:enforce (display-info) on project XXX:
Execution display-info of goal org.apache.maven.plugins:maven-enforcer-
plugin:1.3.1:enforce failed: org.apache.maven.shared.dependency.graph.
DependencyGraphBuilderException : Could not resolve dependencies for
project XXX:XXX:hpi:1.0-SNAPSHOT:
Failure to find org.jenkins-ci.main:jenkins-war:jar:war-for-test:2.76
in https://repo.jenkins-ci.org/public/ was cached in the local
repository, resolution will not be reattempted until the update
interval of repo.jenkins-ci.org has elapsed or updates are forced ->
[Help 1]
我的POM文件如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3</version>
</dependency>
</dependencies>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>2.11</version>
<relativePath/>
</parent>
<groupId>gobuildsandboxbuilder</groupId>
<artifactId>gobuildsandboxbuilder</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>hpi</packaging>
<properties>
<!-- Baseline Jenkins version you use to build the plugin. Users must have this version or newer to run. -->
<jenkins.version>2.76</jenkins.version>
<!-- Other properties you may want to use:
~ java.level: set to 6 if your jenkins.version <= 1.611
~ jenkins-test-harness.version: Jenkins Test Harness version you use to test the plugin. For Jenkins version >= 1.580.1 use JTH 2.0 or higher.
~ hpi-plugin.version: The HPI Maven Plugin version used by the plugin..
~ stapler-plugin.version: The Stapler Maven plugin version required by the plugin.
-->
</properties>
<name>gobuildsandbox builder plugin</name>
<description>gobuildsandbox</description>
<url>https://wiki.jenkins-ci.org/display/JENKINS/TODO+Plugin</url>
<!-- The default licence for Jenkins OSS Plugins is MIT. Substitute for the applicable one if needed. -->
<licenses>
<license>
<name>MIT License</name>
<url>http://opensource.org/licenses/MIT</url>
</license>
</licenses>
<!-- If you want this to appear on the wiki page:
<developers>
<developer>
<id>bhacker</id>
<name>Bob Q. Hacker</name>
<email>bhacker@nowhere.net</email>
</developer>
</developers>
-->
<!-- Assuming you want to host on @jenkinsci:
<scm>
<connection>scm:git:git://github.com/jenkinsci/${project.artifactId}-plugin.git</connection>
<developerConnection>scm:git:git@github.com:jenkinsci/${project.artifactId}-plugin.git</developerConnection>
<url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>
</scm>
-->
<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>
<!-- If you want to depend on other plugins:
<dependencies>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>credentials</artifactId>
<version>2.0</version>
</dependency>
</dependencies>
-->
</project>
此错误仅在将jenkins版本从2.60.3更改为2.76之后才在构建maven项目期间发生,因此我假设它与某些事情有关。