mvn缺少策展人框架

时间:2013-08-09 11:02:46

标签: maven maven-2

我有以下mvn配置文件,当我尝试做mvn包时,它得到

无法执行项目监管服务的目标:无法解决项目监管服务的依赖关系:规则服务:jar:1.0:未能找到com.netflix.curator:curator:jar:1.1.3 in {{ 3}}被缓存在本地存储库中,在中心的更新间隔过去或强制更新之前,不会重新尝试解析 - > [帮助1]

策展人jar是在本地存储库中,任何想法可能有什么问题?谢谢!

<?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>

    <groupId>regulation-service</groupId>
    <artifactId>regulation-service</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>
    <name>regulation-service</name>
    <url>http://maven.apache.org</url>

    <properties>
        <jdk.version>1.6</jdk.version>
    </properties>

    <build>
        <resources>
            <resource>
                <directory>resources</directory>
            </resource>
        </resources>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>${jdk.version}</source>
                    <target>${jdk.version}</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <mainClass>com.elasticride.regulation.RegulationServer</mainClass>
                            <classpathPrefix>dependency-jars/</classpathPrefix>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>

            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>attached</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        ...

        <dependency>
            <groupId>com.netflix.curator</groupId>
            <artifactId>curator</artifactId>
            <version>1.1.3</version>
        </dependency>

        <dependency>
            <groupId>com.netflix.curator</groupId>
            <artifactId>curator-framework</artifactId>
            <version>1.3.3</version>
        </dependency>

        <dependency>
            <groupId>com.netflix.curator</groupId>
            <artifactId>curator-recipes</artifactId>
            <version>1.3.3</version>
        </dependency>


        ....  
    </dependencies>
</project>

1 个答案:

答案 0 :(得分:0)

默认情况下,如果未明确定义type,则在maven中定义依赖关系时,maven会假定该工件为jar

您定义了以下依赖项:

<dependency>
    <groupId>com.netflix.curator</groupId>
    <artifactId>curator</artifactId>
    <version>1.1.3</version>
</dependency>

所以maven试图在存储库中为给定的groupId,artifactId和version找到一个jar工件。但是,在maven central中进行搜索会显示只有pom个文件可用。

您需要将依赖项更改为:

<dependency>
    <groupId>com.netflix.curator</groupId>
    <artifactId>curator</artifactId>
    <version>1.1.3</version>
    <type>pom</type>
</dependency>

或完全删除依赖项。