0

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

未能在项目监管服务上执行目标:无法解决项目监管服务的依赖关系:监管服务:jar:1.0:未能在http://repo中找到 com.netflix.curator:curator:jar:1.1.3 .maven.apache.org/maven2被缓存在本地仓库中,直到中央的更新间隔已经过去或强制更新时才会重新尝试解析 -> [帮助 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>
4

1 回答 1

0

默认情况下,当您在 maven 中定义依赖项时,如果您没有明确定义 atype那么 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>

或者完全删除依赖。

于 2013-08-09T13:36:38.710 回答