Java 为什么maven无法找到添加的依赖项(某些强制执行器规则失败)
我正在使用此处的教程作为起点构建Jenkins插件: 我已经完成了教程,一切正常。现在我想添加真正的功能,所以我需要添加几个依赖项。我是maven新手,但我一般都知道我需要添加依赖XML部分 这是我的POM:Java 为什么maven无法找到添加的依赖项(某些强制执行器规则失败),java,maven,jenkins-plugins,Java,Maven,Jenkins Plugins,我正在使用此处的教程作为起点构建Jenkins插件: 我已经完成了教程,一切正常。现在我想添加真正的功能,所以我需要添加几个依赖项。我是maven新手,但我一般都知道我需要添加依赖XML部分 这是我的POM: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
<?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>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.16</version>
<relativePath />
</parent>
<groupId>io.jenkins.plugins</groupId>
<artifactId>bdptest</artifactId>
<version>${revision}${changelist}</version>
<packaging>hpi</packaging>
<properties>
<revision>1.0</revision>
<changelist>-SNAPSHOT</changelist>
<!-- Baseline Jenkins version you use to build the plugin. Users must have this version or newer to run. -->
<jenkins.version>2.277.1</jenkins.version>
<java.level>8</java.level>
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo> </properties>
<name>BDPTest Plugin</name>
<url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>
<dependencyManagement>
<dependencies>
<dependency>
<!-- Pick up common dependencies for the selected LTS line: https://github.com/jenkinsci/bom#usage -->
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.277.x</artifactId>
<version>25</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>structs</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-cps</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-job</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-basic-steps</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-durable-task-step</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.1</version>
</dependency>
</dependencies>
<licenses>
<license>
<name>MIT License</name>
<url>https://opensource.org/licenses/MIT</url>
</license>
</licenses>
<scm>
<connection>scm:git:git://github.com/${gitHubRepo}.git</connection>
<developerConnection>scm:git:git@github.com:${gitHubRepo}.git</developerConnection>
<url>https://github.com/${gitHubRepo}</url>
<tag>${scmTag}</tag>
</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>
</project>
有人能帮我弄清楚是怎么回事吗?我发现问题出在4.9.1上。。。。尝试了4.2.2,它成功了。。。生活和学习。
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.1</version>
</dependency>
[WARNING] Rule 5: org.apache.maven.plugins.enforcer.RequireUpperBoundDeps failed with message:
Failed while enforcing RequireUpperBoundDeps. The error(s) are [
Require upper bound dependencies error for org.jetbrains.kotlin:kotlin-stdlib-common:1.4.0 paths to dependency are:
+-io.jenkins.plugins:bdptest:1.0-SNAPSHOT
+-com.squareup.okhttp3:okhttp:4.9.1
+-com.squareup.okio:okio:2.8.0
+-org.jetbrains.kotlin:kotlin-stdlib-common:1.4.0
and
+-io.jenkins.plugins:bdptest:1.0-SNAPSHOT
+-com.squareup.okhttp3:okhttp:4.9.1
+-org.jetbrains.kotlin:kotlin-stdlib:1.4.10
+-org.jetbrains.kotlin:kotlin-stdlib-common:1.4.10
]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.515 s
[INFO] Finished at: 2021-04-05T13:25:50-06:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3:enforce (display-info) on project bdptest: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException