无法解析项目com.semantico.counter的依赖项:persistence:jar:1.1.1

时间:2015-08-06 11:41:40

标签: java spring jersey maven-2 restful-architecture

当我运行安装Maven时,它会抛出错误,如。

[INFO] java-COUNTER ...................................... SUCCESS [  1.093 s]
[INFO] java-COUNTER Utils ................................ SUCCESS [  1.312 s]
[INFO] java-COUNTER domain model ......................... SUCCESS [  1.593 s]
[INFO] java-COUNTER persistence layer .................... FAILURE [  2.843 s]
[INFO] java-COUNTER core functionality ................... SKIPPED
[INFO] java-COUNTER inbound message processor ............ SKIPPED
[INFO] java-COUNTER web commons .......................... SKIPPED
[INFO] java-COUNTER message receiver ..................... SKIPPED
[INFO] java-COUNTER client API definition ................ SKIPPED] java-COUNTER API implementation ................... SKIPPED
[INFO] STAR benchmarks ................................... SKIPPED
[INFO] java-COUNTER admin UI ............................. SKIPPED
[INFO] java-COUNTER reporting UI ......................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.029 s
[INFO] Finished at: 2015-08-06T17:01:33+05:30
[INFO] Final Memory: 26M/222M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project persistence: Could not resolve     dependencies for project com.semantico.counter:persistence:jar:1.1.1: Could not find artifact com.semantico.counter:utils:jar:tests:1.1.1 in project_lib (file:///F:\ConnectBooks\star_15Jul15\star_15Jul15\persistence/mvnLib) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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     read the following articles:
[ERROR] [Help 1]     http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the     command
[ERROR]   mvn <goals> -rf :persistence

我的pom.xml文件

<?xml version="1.0" encoding="UTF-8"?>
<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>

<parent>
    <groupId>com.semantico.counter</groupId>
    <artifactId>parent</artifactId>
    <version>1.1.1</version>
</parent>

<groupId>com.semantico.counter</groupId>
<artifactId>receiver</artifactId>

<name>java-COUNTER message receiver</name>

<packaging>war</packaging>

<dependencies>
    <dependency>
        <groupId>com.semantico.counter</groupId>
        <artifactId>web-commons</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.tomcat</groupId>
        <artifactId>tomcat-catalina</artifactId>
    </dependency>

    <dependency>
        <groupId>com.codahale.metrics</groupId>
        <artifactId>metrics-servlet</artifactId>
    </dependency>

    <dependency>
        <!-- CD-1158 For double-click. NB: 2.1.0 is a bit old -->
        <groupId>redis.clients</groupId>
        <artifactId>jedis</artifactId>
        <version>2.1.0</version>
    </dependency>

    <!-- Test scope -->
    <dependency>
        <groupId>com.sun.jersey.jersey-test-framework</groupId>
        <artifactId>jersey-test-framework-grizzly2</artifactId>
    </dependency>
    <dependency>
        <groupId>com.riffpie.common.testing</groupId>
        <artifactId>jersey-test-support</artifactId>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey.contribs</groupId>
        <artifactId>jersey-apache-client</artifactId>
    </dependency>
    <dependency>
        <groupId>com.sun.grizzly</groupId>
        <artifactId>grizzly-webserver</artifactId>
    </dependency>
    <dependency>
        <groupId>com.semantico.counter</groupId>
        <artifactId>persistence</artifactId>
        <type>test-jar</type>
    </dependency>
    <dependency>
        <groupId>com.semantico.counter</groupId>
        <artifactId>utils</artifactId>
        <type>test-jar</type>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.1.3</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.dbunit</groupId>
        <artifactId>dbunit</artifactId>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit-dep</artifactId>
    </dependency>

    <!-- Container provided -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
    </dependency>
</dependencies>

1 个答案:

答案 0 :(得分:0)

您正在配置多模块项目吗?如果是这样,请参阅一些look示例,了解如何配置它们。如果这是你正在采用的方法,那么父pom应该将你的persistence和utils项目声明为模块: -

<modules>
        <module>persistence</module>
        <module>utils</module> 
</modules>

这样,您的父母应该能够访问由于构建两个模块而产生的jar - 而不是将它们作为完全独立的项目。