java - Maven 无法在 Netbeans 7.2 上解析

标签 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 文件。

我查看了该文件,但没有看到要更改的内容。所以我将其包含在下面以供输入:

设置.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>

最佳答案

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

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

关于java - Maven 无法在 Netbeans 7.2 上解析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12876860/

相关文章:

java - Maven 依赖项在 Spring 配置中不可见

maven - Mysema Querydsl : There's no JPAQuery#list() method

postgresql - Netbeans 中的远程数据库连接设置

java - 如何从 JSTL/JSP 标签中的 String[] 属性获取项目

java - 基本偏好安卓

java - 使用多模块项目构建 War

git - 如何在 Netbeans 中显示 .git 文件夹

java连接到sql server 2008express

java - 如何通过 ModelMapper 的 PropertyMap 使用继承

java - @Cacheable 通过 Spring aop - 如何生成唯一的缓存键