首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >蚂蚁任务。传递(pom)依赖项和https问题

蚂蚁任务。传递(pom)依赖项和https问题
EN

Stack Overflow用户
提问于 2020-01-28 12:25:23
回答 3查看 1.1K关注 0票数 5

如你所知,从2020年1月15日开始,Maven中心回购需要HTTPS才能访问。我们的项目之一是使用Ant和Maven Ant任务 (仅限于依赖管理)。是的,我知道这是不可取的,但是在旧的ant构建中使用pom.xml的另一个选择是什么呢?

看起来Maven Ant任务有一个bug,如果依赖树包含一个指向pom的链接,那么它总是通过HTTP访问(尽管本地配置了https://repo.maven.apache.org/maven2)。

关于如何解决bug的任何想法吗?

是的,这是工作配置(即通过HTTP)和https://search.maven.org/artifact/com.google.web.bindery/requestfactory/2.8.2/pom

pom.xml

代码语言:javascript
复制
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.abc</groupId>
  <artifactId>Test</artifactId>
  <version>4.5-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-client</artifactId>
            <version>8.4.5</version>
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <id>central</id>
            <name>Central Repository</name>
            <url>https://repo.maven.apache.org/maven2</url>
            <layout>default</layout>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

</project>

部分build.xml

代码语言:javascript
复制
<artifact:dependencies filesetid="maven.classpath">
    <pom file="../pom.xml" />
</artifact:dependencies>

部分产出

代码语言:javascript
复制
[artifact:dependencies] Downloading: com/vaadin/vaadin-client/8.4.5/vaadin-client-8.4.5.pom from repository central at https://repo.maven.apache.org/maven2
[artifact:dependencies] Transferring 6K from central
[artifact:dependencies] Downloading: com/vaadin/vaadin-root/8.4.5/vaadin-root-8.4.5.pom from repository central at https://repo.maven.apache.org/maven2
[artifact:dependencies] Transferring 40K from central
[artifact:dependencies] Downloading: com/vaadin/vaadin-parent/1.1.0/vaadin-parent-1.1.0.pom from repository central at https://repo.maven.apache.org/maven2
[artifact:dependencies] Transferring 8K from central
[artifact:dependencies] Downloading: com/vaadin/vaadin-shared/8.4.5/vaadin-shared-8.4.5.pom from repository central at https://repo.maven.apache.org/maven2
[artifact:dependencies] Transferring 7K from central
[artifact:dependencies] Downloading: com/vaadin/vaadin-server/8.4.5/vaadin-server-8.4.5.pom from repository central at https://repo.maven.apache.org/maven2
[artifact:dependencies] Transferring 13K from central
[artifact:dependencies] Downloading: org/jsoup/jsoup/1.11.2/jsoup-1.11.2.pom from repository central at https://repo.maven.apache.org/maven2
[artifact:dependencies] Transferring 8K from central
[artifact:dependencies] Downloading: com/vaadin/external/gentyref/1.2.0.vaadin1/gentyref-1.2.0.vaadin1.pom from repository central at https://repo.maven.apache.org/maven2
[artifact:dependencies] Transferring 5K from central
[artifact:dependencies] Downloading: com/google/gwt/gwt-elemental/2.8.2/gwt-elemental-2.8.2.pom from repository central at https://repo.maven.apache.org/maven2
[artifact:dependencies] Transferring 1K from central
[artifact:dependencies] Downloading: com/google/gwt/gwt/2.8.2/gwt-2.8.2.pom from repository central at https://repo.maven.apache.org/maven2
[artifact:dependencies] Transferring 9K from central
[artifact:dependencies] Downloading: org/sonatype/oss/oss-parent/4/oss-parent-4.pom from repository central at https://repo.maven.apache.org/maven2
[artifact:dependencies] Transferring 4K from central
[artifact:dependencies] Downloading: com/google/web/bindery/requestfactory/2.8.2/requestfactory-2.8.2.pom from repository central at http://repo1.maven.org/maven2
[artifact:dependencies] Error transferring file: Server returned HTTP response code: 501 for URL: http://repo1.maven.org/maven2/com/google/web/bindery/requestfactory/2.8.2/requestfactory-2.8.2.pom
[artifact:dependencies] [WARNING] Unable to get resource 'com.google.web.bindery:requestfactory:pom:2.8.2' from repository central (http://repo1.maven.org/maven2): Error transferring file: Server returned HTTP response code: 501 for URL: http://repo1.maven.org/maven2/com/google/web/bindery/requestfactory/2.8.2/requestfactory-2.8.2.pom
[artifact:dependencies] An error has occurred while processing the Maven artifact tasks.
[artifact:dependencies]  Diagnosis:
[artifact:dependencies] 
[artifact:dependencies] Unable to resolve artifact: Unable to get dependency information: Unable to read the metadata file for artifact 'com.google.gwt:gwt-elemental:jar': POM 'com.google.web.bindery:requestfactory' not found in repository: Unable to download the artifact from any repository
[artifact:dependencies] 
[artifact:dependencies]   com.google.web.bindery:requestfactory:pom:2.8.2
[artifact:dependencies] 
[artifact:dependencies] from the specified remote repositories:
[artifact:dependencies]   central (http://repo1.maven.org/maven2),
[artifact:dependencies]   sonatype-nexus-snapshots (https://oss.sonatype.org/content/repositories/snapshots)
[artifact:dependencies] 
[artifact:dependencies]  for project com.google.web.bindery:requestfactory
[artifact:dependencies]   com.google.gwt:gwt-elemental:jar:2.8.2
[artifact:dependencies] 
[artifact:dependencies] from the specified remote repositories:
[artifact:dependencies]   central (https://repo.maven.apache.org/maven2),
[artifact:dependencies]   vaadin-snapshots (https://oss.sonatype.org/content/repositories/vaadin-snapshots/)
[artifact:dependencies] 
[artifact:dependencies] Path to dependency: 
[artifact:dependencies]     1) com.abc:Test:jar:4.5-SNAPSHOT
[artifact:dependencies]     2) com.vaadin:vaadin-client:jar:8.4.5
[artifact:dependencies] 
[artifact:dependencies] 
EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2020-02-13 11:02:46

我们也遇到了同样的问题,这就是为什么我调试jar来找出问题所在的原因。事实证明,您可以通过编辑位于jar (相对路径)org\apache\maven\项目中的pom-4.0.xml来轻松地修复它。只需将urls更改为https,就可以了。

票数 5
EN

Stack Overflow用户

发布于 2020-01-28 12:29:23

你试过手动安装吗?

代码语言:javascript
复制
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> \
    -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
票数 1
EN

Stack Overflow用户

发布于 2020-08-14 18:36:28

我正在研究一个类似的问题,用于构建一个旧版本的Thrift。这就是对我有用的东西。编辑build.xml并在artifact:dependencies块中添加一个remoteRepository

示例:

代码语言:javascript
复制
    <artifact:dependencies filesetId="build-dependency-jars" pomRefId="pom">
      <remoteRepository id="mavenCentral" url="https://repo1.maven.org/maven2"/>
    </artifact:dependencies>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59948747

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档