简体   繁体   English

Maven:依赖项编译错误

[英]maven: dependency compilation error

My pom.xml 我的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>

I am referring cdh site 我指的是CDH网站

I compiled it using 我用它编译

mvn -e clean dependency:copy-dependencies package

I got the following error 我收到以下错误

[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

Dependency cannot be resolved. 依赖关系无法解决。 I checked this site 我检查了这个网站

I can see org.apache.hadoop:hadoop-client:jar:2.0.0-mrl-cdh4.0.0 in the above site. 我可以在上述站点中看到org.apache.hadoop:hadoop-client:jar:2.0.0-mrl-cdh4.0.0 But what jar is in between the above statement? 但是上述声明之间是什么jar Does it cause the error? 它会导致错误吗? How do i resolve this? 我该如何解决?

I am trying to talk to hadoop which is runnin in another machine through java. 我正在尝试与通过Java在另一台机器上运行的hadoop进行交谈。

The problem is that your version <version>2.0.0-mrl-cdh4.0.0</version> uses a l letter instead of 1 . 问题是您的版本<version>2.0.0-mrl-cdh4.0.0</version>使用l字母而不是1 I've checked the cloudera repository which simply does not contain a version 2.0.0-mrl-cdh4.0.0 but it contains a version 2.0.0-mr1-cdh4.0.0 . 我检查了cloudera存储库,该存储库根本不包含版本2.0.0-mrl-cdh4.0.0但其中包含版本2.0.0-mr1-cdh4.0.0

There's a typo in your pom. 您的pom中有错别字。 The dependency "2.0.0-mrl-cdh4.0.0" should be replaced by "2.0.0-mr1-cdh4.4.0" . 依赖项"2.0.0-mrl-cdh4.0.0"应替换为"2.0.0-mr1-cdh4.4.0" You could check this on the cloudera repository. 您可以在cloudera存储库上进行检查。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM