zoukankan      html  css  js  c++  java
  • maven 私服同步无法获取依赖的pom.xml的依赖

    项目中引入了依赖:

    <dependency>
    <groupId>org.apache.hadoop</groupId>
    <artifactId>hadoop-common</artifactId>
    <version>2.6.0-cdh5.7.1</version>
    </dependency>
    

    但是通过公司的私服获取后得到此 jar 的 pom 文件为

    <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>org.apache.hadoop</groupId>
    <artifactId>hadoop-common</artifactId>
    <version>2.6.0-cdh5.7.1</version>
    <description>POM was created by Sonatype Nexus</description>
    </project>
    

    从上面看到没有任何依赖项,所以 maven 没有去下载,进而导致项目报错。

     

    那么问题来了:maven 私服同步的时候回导致同步失败吗 ? 会什么会出现同步后的 pom 不同的情况?,还是公司的网络问题?

    解决方法:1、手动一个一个加上这个jar所需要的dependency依赖,这样太傻了

                  2、网上找一个这个jar的pom依赖文件,根据jar的groupId:artifactId:version去找对应的pom.xml 再去替换一下 

    找到了如下:(部分)

    <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>org.apache.hadoop</groupId>
    <artifactId>hadoop-project-dist</artifactId>
    <version>2.6.0-cdh5.7.1</version>
    <relativePath>../../hadoop-project-dist</relativePath>
    </parent>
    <groupId>org.apache.hadoop</groupId>
    <artifactId>hadoop-common</artifactId>
    <version>2.6.0-cdh5.7.1</version>
    <description>Apache Hadoop Common</description>
    <name>Apache Hadoop Common</name>
    <packaging>jar</packaging>
    <properties>
    <hadoop.component>common</hadoop.component>
    <is.hadoop.component>true</is.hadoop.component>
    <wsce.config.dir>../etc/hadoop</wsce.config.dir>
    <wsce.config.file>wsce-site.xml</wsce.config.file>
    </properties>
    <dependencies>
    <dependency>
    <groupId>org.apache.hadoop</groupId>
    <artifactId>hadoop-annotations</artifactId>
    <scope>compile</scope>
    </dependency>
    <dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava</artifactId>
    <scope>compile</scope>
    </dependency>
    <dependency>
    <groupId>commons-cli</groupId>
    <artifactId>commons-cli</artifactId>
    <scope>compile</scope>
    </dependency>
    <dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-math3</artifactId>
    <scope>compile</scope>
    </dependency>
    <dependency>
    <groupId>xmlenc</groupId>
    <artifactId>xmlenc</artifactId>
    <scope>compile</scope>
    </dependency>
    <dependency>
    <groupId>commons-httpclient</groupId>
    <artifactId>commons-httpclient</artifactId>
    <scope>compile</scope>
    </dependency>
    <dependency>
    <groupId>commons-codec</groupId>
    <artifactId>commons-codec</artifactId>
    <scope>compile</scope>
    </dependency>
    

    最后再次编译获取后成功解决。

    类似的:https://segmentfault.com/q/1010000005354268

  • 相关阅读:
    MongoDB 组合多个条件查询($and、$in、$gte、$lte)
    KafkaConsumer 长时间地在poll(long )方法中阻塞
    Spring MVC整合Mybatis 入门
    JAVA正确地自定义比较对象---如何重写equals方法和hashCode方法
    MyBatis简单使用和入门理解
    使用二分查找判断某个数在某个区间中--如何判断某个IP地址所属的地区
    FastJson使用示例
    linux(ubuntu) 开发环境配置
    android自定义风格的toast
    iPhone跳转的动画效果类型及实现方法 CATransition
  • 原文地址:https://www.cnblogs.com/mistor/p/6602181.html
Copyright © 2011-2022 走看看