【问题标题】:Maven not resolving on Netbeans 7.2Maven 无法在 Netbeans 7.2 上解析
【发布时间】:2012-10-04 07:39:54
【问题描述】:

我对 Maven 非常陌生。我收到以下错误

 The following artifacts could not be resolved: stax:stax:jar:1.0, stax:stax-ri:jar:1.0, clover:clover:jar:1.3-rc4: Failure to find stax:stax:jar:1.0 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

经过一番研究(例如NetBeans: Re-run Maven with the -e switch on / PluginResolutionException),据说我需要编辑我的~/.m2/settings.xml 文件。

我查看了文件,但看不到要更改的内容。所以我把它包括在下面作为输入:

settings.xml

<?xml version="1.0" encoding="UTF-8"?>
<!--
User-specific configuration for maven. Includes things that should not
be distributed with the pom.xml file, such as developer identity, along with
local settings, like proxy information. The default location for the
settings file is ~/.m2/settings.xml
-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!--proxies>
    <proxy>
        <host>my.proxy.host</host>
    </proxy>
</proxies-->

<!--pluginGroups>
    <pluginGroup>org.codehaus.mojo</pluginGroup>
</pluginGroups-->

POM.xml

<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>com.schoolsupplies.v5</groupId>
<artifactId>com.schoolsupplies.v5.test</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>com.schoolsupplies.v5.test</name>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.10</version>
        <scope>test</scope>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-client</artifactId>
        <version>1.14</version>
        <scope>test</scope>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>org.codehaus.jettison</groupId>
        <artifactId>jettison</artifactId>
        <version>1.1</version>
        <scope>test</scope>
        <type>jar</type>
    </dependency>
  <dependency>
    <groupId>dom4j</groupId>
    <artifactId>dom4j</artifactId>
    <version>20040902.021138</version>
    <type>jar</type>
  </dependency>
</dependencies>

【问题讨论】:

    标签: java maven netbeans-7


    【解决方案1】:

    我打开依赖项目录并删除所有出现问题的 jar 文件——尤其是因为它们没有在 pom.xml 文件中明确调用。完成后,一切正常。

    似乎 maven 决定我的一些显式导入的依赖项需要这些文件。就我而言:stax:stax-ri:jar:1.0clover:clover:jar:1.3-rc4

    【讨论】:

      【解决方案2】:

      我也有同样的错误。我将存储库添加到 pom.xml 中,一切正常。

      像这个例子:

      <repositories>
        <repository>
          <id>bukkit-repo</id>
          <url>http://repo.bukkit.org/content/groups/public/</url>
        </repository>
      <repositories>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-07-28
        • 1970-01-01
        • 2019-10-22
        • 2014-04-22
        • 1970-01-01
        • 2012-01-02
        相关资源
        最近更新 更多