Maven没有解决Netbeans 7.2

时间:2012-10-13 20:48:37

标签: java maven netbeans-7

我对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>

2 个答案:

答案 0 :(得分:0)

我打开依赖项目录并删除所有麻烦的jar - 特别是因为它们没有在pom.xml文件中明确调用。完成后,一切正常。

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

答案 1 :(得分:0)

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

就像这个例子:

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