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

  • 相关阅读:
    JAVA 解压压缩包中指定文件或实现压缩文件的预览及下载单个或多个指定的文件
    java 解压zip java.lang.IllegalArgumentException: MALFORMED 错误
    Java文件管理系统
    Java实现用汉明距离进行图片相似度检测的
    url 编码(percentcode 百分号编码)
    nodejs进程管理
    nodejs网络编程
    nodejs内存溢出 FATAL ERROR: CALL_AND_RETRY_0 Allocation failed – process out of memory
    connect ECONNREFUSED 127.0.0.1:80错误解决
    nuxtjs如何在单独的js文件中引入store和router
  • 原文地址:https://www.cnblogs.com/mistor/p/6602181.html
Copyright © 2011-2022 走看看