仅在 Eclipse 中获取“<name> 的 POM 无效,传递依赖项(如果有)将不可用”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26393332/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 05:25:59  来源:igfitidea点击:

Getting "The POM for <name> is invalid, transitive dependencies (if any) will not be available" only in Eclipse

eclipsemavenjaxbm2e

提问by lexicore

I have recently upgraded to JAXB 2.2.11 and noticed in my Eclipse console the following message:

我最近升级到 JAXB 2.2.11 并在我的 Eclipse 控制台中注意到以下消息:

10/15/14, 11:42:46 PM GMT+2: [INFO] Creating new launch configuration
10/15/14, 11:42:58 PM GMT+2: [INFO] C:\Projects\workspaces\mj2p\maven-jaxb2-plugin-project\tests\JAXB-1044
10/15/14, 11:42:58 PM GMT+2: [INFO]  mvn  -B -X -e clean install
10/16/14, 12:09:07 AM GMT+2: [WARN] The POM for com.sun.xml.bind:jaxb-impl:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available: 1 problem was encountered while building the effective model for com.sun.xml.bind:jaxb-impl:2.2.11
[ERROR] 'dependencyManagement.dependencies.dependency.systemPath' for com.sun:tools:jar must specify an absolute path but is ${tools.jar} @ 

10/16/14, 12:09:07 AM GMT+2: [WARN] The POM for com.sun.xml.bind:jaxb-xjc:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available: 1 problem was encountered while building the effective model for com.sun.xml.bind:jaxb-xjc:2.2.11
[ERROR] 'dependencyManagement.dependencies.dependency.systemPath' for com.sun:tools:jar must specify an absolute path but is ${tools.jar} @ 

10/16/14, 12:09:07 AM GMT+2: [WARN] The POM for com.sun.xml.bind:jaxb-core:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available: 1 problem was encountered while building the effective model for com.sun.xml.bind:jaxb-core:2.2.11
[ERROR] 'dependencyManagement.dependencies.dependency.systemPath' for com.sun:tools:jar must specify an absolute path but is ${tools.jar} @ 

What puzzles me is that I am not getting this warning in console. The poms in question also seems to be correct. I am sure I am using the same Maven installation in the console and in Eclipse (m2e). The repository also seems to be correct.

让我感到困惑的是,我没有在控制台中收到此警告。pom有问题的s 似乎也是正确的。我确定我在控制台和 Eclipse ( m2e) 中使用相同的 Maven 安装。存储库似乎也是正确的。

Does anyone happen to know, what could be causing this?

有没有人碰巧知道,这可能是什么原因造成的?

Please note that this is not a duplicate for (almost identically-named) question:

This question is about the differences between Maven execution in the console and from the Eclipse.

请注意,这不是(几乎同名)问题的重复:

这个问题是关于 Maven 在控制台和 Eclipse 中执行之间的差异。

采纳答案by lexicore

After further investigation it appears that I have the same problem as in this question:

经过进一步调查,我似乎遇到了与此问题相同的问题:

Maven not picking JAVA_HOME correctly

Maven 没有正确选择 JAVA_HOME

The solutionthanks to @rustyx (please upvote that answer):

感谢@rustyx的解决方案(请支持该答案):

To fix the issue you need to start Eclipse using the JRE from the JDK by adding something like this to eclipse.ini(before -vmargs!):

要解决此问题,您需要使用 JDK 中的 JRE 启动 Eclipse,方法是在eclipse.ini(之前-vmargs!)中添加以下内容:

-vm
C:\<your_path_to_jdk170>\jre\bin\javaw.exe

回答by Raghuram

The pomfor com.sun.xml.bind.jaxb-implhas com.sun.xml.bind:jaxb-parenthas its parent.

pomcom.sun.xml.bind.jaxb-implcom.sun.xml.bind:jaxb-parent拥有其母公司。

jaxb-parent pomhas the following section:

jaxb-parent pom有以下部分:

<profile>
    <id>default-tools.jar</id>
    <activation>
        <file>
            <exists>${java.home}/../lib/tools.jar</exists>
        </file>
    </activation>
    <properties>
        <tools.jar>${java.home}/../lib/tools.jar</tools.jar>
    </properties>
</profile>
<profile>
    <id>default-tools.jar-mac</id>
    <activation>
    <file>
        <exists>${java.home}/../Classes/classes.jar</exists>
    </file>
    </activation>
    <properties>
        <tools.jar>${java.home}/../Classes/classes.jar</tools.jar>
    </properties>
</profile>

In your Eclipse, neither of the profile seems to be activated due to which ${tools.jar}does not have a value.

在您的 Eclipse 中,似乎没有一个配置文件被激活,因为它${tools.jar}没有值。

One possibility could be JAVA_HOMEvalue is set incorrectly.

一种可能是JAVA_HOME值设置不正确。