maven:依赖编译错误

时间:2015-03-06 08:52:45

标签: java maven

我的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 XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0   http://maven.apache.org/v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.myorg.write</groupId>
<artifactId>simple-client</artifactId>
<packaging>jar</packaging>
<version>0.1.0</version>

<repositories>
 <repository>
  <id>cloudera</id>
  <url>https://repository.cloudera.com/artifactory/cloudera-repos/</url>
 </repository>
</repositories>

<dependencies>
   <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-client</artifactId>
            <version>2.0.0-mrl-cdh4.0.0</version>
    </dependency>
</dependencies>

<build>
  <plugins>
   <plugin>
       <groupId>org.codehaus.mojo</groupId>
       <artifactId>exec-maven-plugin</artifactId>
       <version>1.3.2</version>
       <configuration>
        <mainClass>org.myorg.Write</mainClass>
       </configuration>
   </plugin>
   <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
     </configuration>
  </plugin>
  </plugins>
 </build>
  </project>

我指的是cdh site

我用

编译了它
mvn -e clean dependency:copy-dependencies package

我收到以下错误

[ERROR] Failed to execute goal on project simple-client: Could not resolve 
dependencies for project org.myorg.write:simple-client:jar:0.1.0: Failur\
e to find org.apache.hadoop:hadoop-client:jar:2.0.0-mrl-cdh4.0.0 in 
https://repository.cloudera.com/artifactory/cloudera-repos/ was cached in 
the local repository, resolution will not be reattempted until the update 
interval of cloudera has elapsed or updates are forced -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute 
goal on project simple-client: Could not resolve dependencies for project
org.myorg.write:simple-client:jar:0.1.0: Failure to find 
org.apache.hadoop:hadoop-client:jar:2.0.0-mrl-cdh4.0.0 in 
https://repository.cloudera.com /artifactory/cloudera-repos/ was cached in  
the local repository, resolution will not be reattempted until the update 
interval of cloudera has elapsed or updates are forced

无法解决依赖关系。我查看了this site

我可以在上面的网站上看到org.apache.hadoop:hadoop-client:jar:2.0.0-mrl-cdh4.0.0。但是jar在上述陈述之间是什么?它会导致错误吗?我该如何解决这个问题?

我正在尝试与通过java在另一台机器上运行的hadoop交谈。

2 个答案:

答案 0 :(得分:1)

问题是您的版本<version>2.0.0-mrl-cdh4.0.0</version>使用的是l字母,而不是1。我已经检查了cloudera存储库,它只包含版本2.0.0-mrl-cdh4.0.0,但它包含版本2.0.0-mr1-cdh4.0.0

答案 1 :(得分:1)

你的pom中有一个拼写错误。 依赖项"2.0.0-mrl-cdh4.0.0"应替换为"2.0.0-mr1-cdh4.4.0"。 您可以在cloudera存储库中查看此内容。