【问题标题】:Getting "The POM for <name> is invalid, transitive dependencies (if any) will not be available" only in Eclipse仅在 Eclipse 中获取“<name> 的 POM 无效,传递依赖项(如果有)将不可用”
【发布时间】:2014-12-11 04:00:01
【问题描述】:

我最近升级到 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} @ 

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

有谁知道,这可能是什么原因造成的?

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

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

【问题讨论】:

    标签: eclipse maven jaxb m2e


    【解决方案1】:

    com.sun.xml.bind:jaxb-osgi:jar:2.2.10 的 pom 是无效问题。 将放心的版本更新到 4.1.1 后为我工作。

    【讨论】:

      【解决方案2】:

      正如其他人指出的那样,这可能是因为 JRE 在 Eclipse 中设置不正确。

      我通过在 Window>Preferences>Java>Installed JRE's 中添加正确的条目(指向 mi JDK 的安装位置)解决了这个问题

      进行此更改后,可能需要进行项目清理。

      【讨论】:

        【解决方案3】:

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

        Maven not picking JAVA_HOME correctly

        solution 感谢@rustyx(请为该答案投票):

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

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

        【讨论】:

          【解决方案4】:

          com.sun.xml.bind.jaxb-implpomcom.sun.xml.bind:jaxb-parent 有它的父级。

          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>
          

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

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

          【讨论】:

          • 刚刚重新检查:JAVA_HOME设置正确,工作区设置了JDK。我不太确定如何调试它。
          • 任何机会mvn:help-effective-pom 有效,如果有效,它会提供什么输出?
          • 请看我的其他回答。这是一个 Eclipse 错误(java.home 默认未正确传递)。
          • 在我的例子中 JAVA_HOME 不是指向 bin 目录而是指向它的父目录。解决这个问题解决了我的问题
          • JAVA_HOME 应立即指向bin 文件夹上方 的文件夹。然后将%JAVA_HOME%\bin 添加到PATH 变量中,或$JAVA_HOME/bin
          猜你喜欢
          • 2014-06-28
          • 2021-12-01
          • 2018-02-26
          • 2016-12-15
          • 2011-08-30
          • 2011-07-25
          • 1970-01-01
          • 2020-04-26
          • 2012-12-03
          相关资源
          最近更新 更多