简体   繁体   English

在Eclipse中创建org.jenkins-ci.plugins时出现maven-enforcer-plugin问题

[英]maven-enforcer-plugin issue while creating org.jenkins-ci.plugins in eclipse

I try to get a minimal empty jenkins plugin to compile and show in a jetty jenkins. 我尝试获得一个最小的空jenkins插件来编译并显示在一个码头jenkins中。

I created a new Java Project and made it into a maven project. 我创建了一个新的Java项目并将其变成一个Maven项目。 Right Click -> Configure -> Into Maven . Right Click -> Configure -> Into Maven

My problem stems from the Parent. 我的问题出在父母身上。

Group Id: org.jenkins-ci.plugins 
Artifact Id: plugin
Version: 3.9

When I execute the Goal RunAs -> Maven -> Install I get an error. 当我执行目标RunAs -> Maven -> Install ,出现错误。 The error string contains: 错误字符串包含:

maven-enforcer-plugin:3.0.0-M1:enforce failed: Unknown JDK version given. Should be something like "1.7"

I Installed multiple Java Versions in the machine so I should have some to choose from. 我在机器上安装了多个Java版本,因此应该有一些选择。 I tried to set a deifferent JRE dependency in the Project Propererties with no effect. 我试图在项目属性中设置不同的JRE依赖关系,但没有任何效果。

A bit further up there is a relevant output: 再往上有一个相关的输出:

[INFO] --- maven-enforcer-plugin:3.0.0-M1:display-info (display-info) @ ManualTestingMapper ---
[INFO] Maven Version: 3.3.9
[INFO] JDK Version: 1.8.0_162 normalized as: 1.8.0-162
[INFO] OS Info: Arch: amd64 Family: windows Name: windows 7 Version: 6.1
[INFO] 
[INFO] --- maven-enforcer-plugin:3.0.0-M1:enforce (display-info) @ ManualTestingMapper ---

My Windows environment has JAVA_HOME=c:\\Program Files (x86)\\Java\\jre8u152 and the PATH also points in that general direction. 我的Windows环境具有JAVA_HOME=c:\\Program Files (x86)\\Java\\jre8u152 ,并且PATH也指向该常规方向。

How does one fix this in eclipse? 如何在Eclipse中解决此问题? I would need to change the JDK version on a per project level. 我将需要在每个项目级别上更改JDK版本。 I can not find anything useful using google - those were all dead ends fir me. 我找不到使用Google的任何有用的东西-这些都是死胡同。

EDIT: I should mention that changing the Project Facets to Java 1.7 gives the enforcer output: 编辑:我应该提到将Project Facets更改为Java 1.7会提供强制输出:

[INFO] --- maven-enforcer-plugin:3.0.0-M1:display-info (display-info) @ ManualTestingMapper ---
[INFO] Maven Version: 3.3.9
[INFO] JDK Version: 1.7.0_80 normalized as: 1.7.0-80
[INFO] OS Info: Arch: amd64 Family: windows Name: windows 7 Version: 6.1
[INFO] 
[INFO] --- maven-enforcer-plugin:3.0.0-M1:enforce (display-info) @ ManualTestingMapper ---

The error about needing JDK 1.7 is still the same though. 但是,有关需要JDK 1.7的错误仍然相同。

EDIT: Here is my POM, I updated the IDs to something neutral. 编辑:这是我的POM,我将ID更新为中性。

<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>SOGrouID</groupId>
  <artifactId>SOArtifactID</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>SOName</name>
  <description>SOName is a Stackoverflow Example.</description>
  <parent>
    <groupId>org.jenkins-ci.plugins</groupId>
    <artifactId>plugin</artifactId>
    <version>3.9</version>
  </parent>
</project>

The parent POM contains 父POM包含

<requireJavaVersion>
<version>[1.8.0,)</version>
</requireJavaVersion>

which raises more questions than it answers. 提出的问题多于答案。 The whole parent POM can be inspected on github. 可以在github上检查整个父POM

EDIT: Running the maven goal Install -X gives the exception type: 编辑:运行Maven目标Install -X给出异常类型:

java.lang.IllegalArgumentException: Unknown JDK version given. Should be something like "1.7"

I guess "1.7" could be meant as a format example. 我想“ 1.7”可以作为格式示例。 If that is so then the plugin may be presented with an incomprehensible format string of sorts? 如果是这样的话,那么插件可能会出现难以理解的格式字符串?

Thanks to @Kai who pointed me towards the parent POM. 感谢@Kai,他将我指向了父级POM。 There are a bunch of properties that are marked with you-must-override . 有许多标记为you-must-override的属性。 One of them is 其中之一是

<java.level>you-must-override-the-java.level-property</java.level>

The IllegalArgumentException comes from the string that was given. IllegalArgumentException来自给定的字符串。

Overriding that property in the pom removes the issue. 覆盖pom中的该属性可消除此问题。

  <properties>
    <java.level>8</java.level>
  </properties>  

The problem isn't related to your installed Java version. 该问题与您安装的Java版本无关。 Open the pom.xml and look for the maven-enforcer-plugin. 打开pom.xml并查找maven-enforcer-plugin。 I guess the configuration is wrong here, there should be something like: 我猜这里的配置错误,应该是这样的:

<requireJavaVersion>
  <version>1.7</version>
</requireJavaVersion>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法执行目标 org.apache.maven.plugins:maven-enforcer-plugin - Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin 无法执行 org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce: org/codehaus/plexus/util/StringUtils - Fail to execute org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce: org/codehaus/plexus/util/StringUtils 当maven 3.2.5在travis-ci.org上与3.1.1一起运行时,为什么会检测到maven 3.2.5? - Why does maven-enforcer-plugin detect maven 3.2.5 when it's run with 3.1.1 on travis-ci.org? 无法执行Maven-Enforcer-Plug - Failed to execute maven-enforcer-plugin Maven 插件问题:maven-enforcer-plugin:3.0.0-M3:enforce 有些 Enforcer 规则失败 - Problem with Maven plugin :maven-enforcer-plugin:3.0.0-M3:enforce Some Enforcer rules have failed 版本:display-plugin-updates不了解maven-enforcer-plugin - versions:display-plugin-updates does not understand maven-enforcer-plugin 了解如何在某些pom文件中使用maven-enforcer-plugin - Find out how maven-enforcer-plugin is used in certain pom files org.apache.maven.plugins.enforcer.RequireUpperBoundDeps 失败并显示以下消息: - org.apache.maven.plugins.enforcer.RequireUpperBoundDeps failed with message: org.apache.maven.plugins:即使在Eclipse中有Maven插件,maven-compiler-plugin也丢失了 - org.apache.maven.plugins:maven-compiler-plugin is missing even there is a maven plug in in eclipse 詹金斯 org.apache.maven.plugins:maven-compiler-plugin:2.0.2 - Jenkins org.apache.maven.plugins:maven-compiler-plugin:2.0.2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM