gpt4 book ai didi

java - org.eclipse.persistence.moxy;2.3.2 : not found when resolving jersey-bundle 1. 19.1

转载 作者:行者123 更新时间:2023-12-02 12:53:25 30 4
gpt4 key购买 nike

我在尝试 ivy:install 时遇到异常jersey-bundle 1.19.1模块到本地(基于文件系统)ivy 解析器。我已经成功地使用下面更短的代码重现了这个。

失败案例

我在 ivysettings.xml 中定义了两个解析器以下。一是公众ibiblio解析器,另一个是本地(基于文件系统的解析器),我想将 ibiblio 中的模块(及其依赖项)复制到其中。 :

<ivysettings>
<settings defaultResolver="public" />

<resolvers>
<ibiblio name="public" m2compatible="true" />

<filesystem name="fs-local">
<ivy
pattern="/tmp/local-ivy-repo/[organisation]/[module]/ivys/ivy-[revision].xml"/>
<artifact
pattern="/tmp/local-ivy-repo/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
</filesystem>

</resolvers>
</ivysettings>

使用上面的ivysettings.xml然后我将以下 Ant 文件写入 ivy:install我感兴趣的模块:

<project name="local repository importation" default="install-locally">

<target name="install-locally" description="import module from public Maven repository and install into local filesystem repository" xmlns:ivy="antlib:org.apache.ivy.ant">
<ivy:settings id="ivysettings-ibiblio-to-local" file="ivysettings.xml"/>
<ivy:install settingsRef="ivysettings-ibiblio-to-local"
organisation="com.sun.jersey"
module="jersey-bundle"
revision="1.19.1"
from="public"
to="fs-local"
transitive="true"
overwrite="true"/>
</target>
</project>

当我执行(使用 Ant )上述文件时,我最终收到以下消息:

 :: problems summary ::
:::: WARNINGS
module not found: org.eclipse.persistence#org.eclipse.persistence.moxy;2.3.2
==== public: tried
https://repo1.maven.org/maven2/org/eclipse/persistence/org.eclipse.persistence.moxy/2.3.2/org.eclipse.persistence.moxy-2.3.2.pom
-- artifact org.eclipse.persistence#org.eclipse.persistence.moxy;2.3.2!org.eclipse.persistence.moxy.jar:
https://repo1.maven.org/maven2/org/eclipse/persistence/org.eclipse.persistence.moxy/2.3.2/org.eclipse.persistence.moxy-2.3.2.jar
::::::::::::::::::::::::::::::::::::::::::::::
:: UNRESOLVED DEPENDENCIES ::
::::::::::::::::::::::::::::::::::::::::::::::
:: org.eclipse.persistence#org.eclipse.persistence.moxy;2.3.2: not found
::::::::::::::::::::::::::::::::::::::::::::::

这显然是警告而不是错误(不确定这种情况下的差异有多重要)。寻找/tmp/local-ivy-repo/目录中我看到许多模块和 jar(包括 jersey-bundle )。

成功案例

另一方面,如果我尝试拉下 jersey-bundle来自公共(public)存储库的依赖项(不使用 ivy:install 在本地“安装”它),例如使用以下 Ant 文件:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:ivy="antlib:org.apache.ivy.ant"
basedir="."
default="retrieve-ivy-deps"
name="foo">

<target name="retrieve-ivy-deps"
description="resolve and retrieve dependencies with ivy">
<ivy:settings file="ivysettings.xml"/>
<ivy:resolve file="ivy.xml"/>
<ivy:retrieve conf="with-transitive"
pattern="ivy-jars/[artifact]-[revision](-[classifier]).[ext]"
sync="true"
type="jar, bundle"/>
</target>

</project>

...以及以下 Ivy 文件:

<?xml version="1.0" encoding="ISO-8859-1"?>
<ivy-module version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
<info organisation="foo" module="bar"/>
<configurations>
<conf name="with-transitive" description="IVY jars with transitive dependencies"/>
</configurations>
<dependencies>
<dependency org="com.sun.jersey" name="jersey-bundle" rev="1.19.1" conf="with-transitive->default"/>
</dependencies>
</ivy-module>

...然后,我没有看到任何错误或警告,并且在操作结束时我在 ivy-jars 中看到两个文件目录:jersey-bundle-1.19.1.jarjsr311-api-1.1.1.jar .

我的问题是:

  1. 失败案例中警告消息的含义和意义是什么?我该如何解决?
  2. 为什么 Ant/Ivy 能够从 ibiblio 拉取模块jersey-bundle 1.19.1及其所有传递依赖项,不会失败,但无法 ivy:install它?换句话说,为什么成功的案例会成功,失败的案例会失败?
  3. 在成功的情况下,在相应的 Ivy 文件中,我要求提供模块及其所有传递依赖项(因为我使用 default 配置: <dependency org="com.sun.jersey" name="jersey-bundle" rev="1.19.1" conf="with-transitive->default"/> )。但只下载了 2 个 jar。与此相反,当我查看ivy-1.19.1.xml时当我查看 /tmp/local-ivy-repo/ 时,我看到大约 20 个依赖项,即使在失败的情况下也是如此。目录我看到了所有这些(除了 moxy 2.3.2 )。为什么会出现这种差异?

最佳答案

在安装任务上使用如下配置:

<ivy:install organisation="com.sun.jersey" ... conf="compile"/>

包含配置映射始终是个好主意。该错误似乎是检索不存在的可选“提供”范围依赖项时出现的问题。

示例

├── build.xml
├── ivysettings.xml
└── local-ivy-repo
├── com.sun.jersey
│   └── jersey-bundle
│   └── ivys
│   ├── ivy-1.19.1.xml
│   ├── ivy-1.19.1.xml.md5
│   └── ivy-1.19.1.xml.sha1
└── javax.ws.rs
└── jsr311-api
├── ivys
│   ├── ivy-1.1.1.xml
│   ├── ivy-1.1.1.xml.md5
│   └── ivy-1.1.1.xml.sha1
└── jars
├── jsr311-api-1.1.1.jar
├── jsr311-api-1.1.1.jar.md5
└── jsr311-api-1.1.1.jar.sha1

build.xml

<project name="demo" default="build" xmlns:ivy="antlib:org.apache.ivy.ant">

<target name="build">
<ivy:install organisation="com.sun.jersey"
module="jersey-bundle"
revision="1.19.1"
from="public"
to="fs-local"
transitive="true"
overwrite="true"
conf="compile"/>
</target>

</project>

ivysettings.xml

<ivysettings>
<settings defaultResolver="public" />

<resolvers>
<ibiblio name="public" m2compatible="true" />

<filesystem name="fs-local">
<ivy pattern="${ivy.settings.dir}/local-ivy-repo/[organisation]/[module]/ivys/ivy-[revision].xml"/>
<artifact pattern="${ivy.settings.dir}/local-ivy-repo/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
</filesystem>
</resolvers>

</ivysettings>

关于java - org.eclipse.persistence.moxy;2.3.2 : not found when resolving jersey-bundle 1. 19.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44525727/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com