【问题标题】:Maven: could not resolve dependencies. Fails to find specific jarMaven:无法解析依赖关系。找不到特定的 jar
【发布时间】:2014-09-22 08:17:45
【问题描述】:

我在 github 上找到了一个项目,其中提供了 pom.xml 文件,该文件在 maven 中编译为 war 文件。但是,构建项目失败并提供警告,指出无法找到特定依赖项 (com.emc.cto.xProcRESTFramework) 的 POM。我查看了项目的文件夹,不存在这样的文件。我已经尝试在网上查找,但找不到依赖项。

我做错了什么?

感谢您的帮助!

以下是 maven 在尝试全新安装时产生的错误。

[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building RIDAgent 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.emc.cto:XProcRESTFrameworkMVC:jar:0.0.4-SNAPSHOT is mi
ssing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.578 s
[INFO] Finished at: 2014-07-30T16:00:34+01:00
[INFO] Final Memory: 9M/107M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project RIDAgent: Could not resolve dependenci
es for project RIDAgent:RIDAgent:war:0.0.1-SNAPSHOT: Failure to find com.emc.cto
:XProcRESTFrameworkMVC:jar:0.0.4-SNAPSHOT in http://download.java.net/maven/2 wa
s cached in the local repository, resolution will not be reattempted until the u
pdate interval of java.net maven repository has elapsed or updates are forced ->
 [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyReso
lutionException

这是 pom 文件:

<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>RIDAgent</groupId>
<artifactId>RIDAgent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <downloadSources>true</downloadSources>
    <downloadJavadocs>true</downloadJavadocs>
    <slf4j-version>1.5.2</slf4j-version>
    <jersey-version>1.1.5.1</jersey-version>
    <xdb-version>10.1</xdb-version>
    <calumet-version>1.0.13</calumet-version>
    <org.springframework.version>3.0.5.RELEASE</org.springframework.version>
    <spring-security-version>3.0.5.RELEASE</spring-security-version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${slf4j-version}</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>${slf4j-version}</version>
    </dependency>
    <!-- Core utilities used by other modules. Define this if you use Spring 
        Utility APIs (org.springframework.core.*/org.springframework.util.*) -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <!-- Expression Language (depends on spring-core) Define this if you use 
        Spring Expression APIs (org.springframework.expression.*) -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-expression</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <!-- Bean Factory and JavaBeans utilities (depends on spring-core) Define 
        this if you use Spring Bean APIs (org.springframework.beans.*) -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <!-- Aspect Oriented Programming (AOP) Framework (depends on spring-core, 
        spring-beans) Define this if you use Spring AOP APIs (org.springframework.aop.*) -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aop</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <!-- Application Context (depends on spring-core, spring-expression, spring-aop, 
        spring-beans) This is the central artifact for Spring's Dependency Injection 
        Container and is generally always Defined -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <!-- Web application development utilities applicable to both Servlet and 
        Portlet Environments(depends on spring-core, spring-beans, spring-context) 
        Define this if you use Spring MVC, or wish to use Struts, JSF, or another 
        web framework with Spring (org.springframework.web.*) -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <!-- Spring MVC for Servlet Environments (depends on spring-core, spring-beans, 
        spring-context, spring-web) Define this if you use Spring MVC with a Servlet 
        Container such as Apache Tomcat (org.springframework.web.servlet.*) -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${org.springframework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.geronimo.specs</groupId>
        <artifactId>geronimo-servlet_3.0_spec</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>com.emc.cto</groupId>
        <artifactId>XProcRESTFrameworkMVC</artifactId>
        <version>0.0.4-SNAPSHOT</version>
    </dependency>

    <!-- Adding for JSP JSTL support for JSP pages -->

    <dependency>
        <groupId>taglibs</groupId>
        <artifactId>standard</artifactId>
        <version>1.1.2</version>
    </dependency>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.1.0</version>
    </dependency>

    <!-- dependency to fix JSPServletException -->
    <dependency>
        <groupId>org.apache.tomcat</groupId>
        <artifactId>jsp-api</artifactId>
        <version>6.0.32</version>
        <scope>provided</scope>
    </dependency>


    <!-- HttpComponents -->

    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.2.1</version>
    </dependency>

    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpcore</artifactId>
        <version>4.2.1</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-config</artifactId>
        <version>3.0.5.RELEASE</version>
    </dependency>


    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-web</artifactId>
        <version>3.0.5.RELEASE</version>
    </dependency>
    <!-- JAXB Dependency for custom namespace declaration -->
    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-impl</artifactId>
        <version>2.2.5</version>
    </dependency>
    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.6</version>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpmime</artifactId>
        <version>4.2.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-build-plugin</artifactId>
        <version>1.3</version>
    </dependency>


</dependencies>

<repositories>
    <repository>
        <id>Repo Maven archive</id>
        <name>Apache Maven Community Repository</name>
        <url>http://repo1.maven.org/maven2</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <releases>
            <enabled>true</enabled>
        </releases>
    </repository>
    <repository>
        <id>java.net maven repository</id>
        <name>Repository for Maven2</name>
        <url>http://download.java.net/maven/2</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <releases>
            <enabled>true</enabled>
        </releases>
    </repository>
</repositories>

<distributionManagement>
</distributionManagement>


<build>
    <plugins>
        <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>maven-jetty-plugin</artifactId>
            <extensions>false</extensions>
            <inherited>false</inherited>
        </plugin>
        <!-- Build the JAR with dependencies -->
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
            </configuration>
        </plugin>
    </plugins>
    <!-- Build with Java 1.6 -->
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <showWarnings>true</showWarnings>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

【问题讨论】:

  • 您永远不会在 Maven Central 中找到 SNAPSHOT 依赖项,也不会在配置的 java.net 存储库中找到不包含来自 'com.emc.*' 的工件。因此,找到包含这些依赖项的存储库不是 Maven 的问题。
  • 谢谢!所以你是说我应该回到我得到这个 pom 的地方,看看我是否能找到有关如何访问这些存储库的信息?
  • 是正确的方式。 community.emc.com/docs/DOC-10752

标签: java maven github dependencies pom.xml


【解决方案1】:

添加此依赖项,它将根据我的需要工作:

<dependency> <groupId>com.emc.cto</groupId> <artifactId>XProcRESTFrameworkMVC</artifactId> <version>0.0.4-SNAPSHOT</version> </dependency>

【讨论】:

    【解决方案2】:

    据我所知,它不在公共仓库中,但您可以从这里下载源代码:https://community.emc.com/docs/DOC-10494(需要注册)。

    【讨论】:

      【解决方案3】:

      Maven 的存储库中不存在 xProcRESTFramework。

      http://search.maven.org/#search%7Cga%7C1%7CxProcRESTFramework

      如果您可以找到 xProcRESTFramework 文件,您可以创建一个本地 maven 存储库并将其添加到您的 maven 项目中。

      【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-29
      • 2020-08-16
      • 2016-01-28
      • 2020-09-09
      • 2022-01-23
      • 2020-09-17
      • 2015-06-04
      • 2019-08-13
      相关资源
      最近更新 更多