我正忙着用常春藤弄湿我的脚。我有一个在本地 PC 上运行的现有 nexus 存储库,以及一个现有的 ant 构建脚本。
两者都工作正常。
部分构建脚本有一些文件可以从网络共享中检索我们的 3rdparty jar 文件(log4j、xmlbeans、junit、pdf 等)——这充其量是 klunky。
我想使用 ivy 的依赖机制从 nexus 存储库中检索这些文件并在构建中使用它。每个 3rdparty 库都有一个名称和一组任意文件(jar、dll、license.dat、xml 等)。
由于我们有大量这些 3rdparty 库并且每个库都有多个文件 - 手动上传到 nexus 不是一种选择 - 我需要一些可以用来获取一组文件的东西,给它们一个库名称,一个版本号和将结果上传到nexus。那么我需要能够从常春藤中检索它。
我设法让上传部分工作,但检索过程不起作用。使用我们的 xmlbeans lib 作为起点,我创建了以下 ivy.xml 文件
<ivy-module version="1.0">
<info organisation="thirdparty_tools" module="xmlbeans" status="integration">
<publications>
<artifact name="jsr173_api" type="jar" ext="jar"/>
<artifact name="saxon-dom" type="jar" ext="jar"/>
<artifact name="saxon-xpath" type="jar" ext="jar"/>
<artifact name="saxon" type="jar" ext="jar"/>
<artifact name="xbean" type="jar" ext="jar"/>
<artifact name="xbean_xpath" type="jar" ext="jar"/>
<artifact name="xmlpublic" type="jar" ext="jar"/>
</publications>
</ivy-module>
然后一些 ant 脚本将其发布到 nexus:
<ivy:resolve/>
<ivy:publish <ivy:publish resolver="thirdparty" forcedeliver="true" update="true" revision="${version}" overwrite="true">
<artifacts pattern="[artifact].[ext]"/>
<ivy:publish/>
这一切都很好。它将所有 jar 文件发布到预期目录中的 nexus。
当我尝试在我的构建中使用它时,问题就来了。我为我的构建创建了以下 ivy.xml 文件:
<ivy-module version="1.0">
<info organisation="myCompany" module="GLB_Data"/>
<dependencies>
<dependency org="thirdparty_tools" name="xmlbeans" rev="2.2.0"/>
</dependencies>
</ivy-module>
然后当我运行我的构建时 - 它找不到任何东西:
::::::::::::::::::::::::::::::::::::::::::::::
:: UNRESOLVED DEPENDENCIES ::
::::::::::::::::::::::::::::::::::::::::::::::
:: thirdparty_tools#jsr173_api;2.2.0: not found
:: thirdparty_tools#saxon-dom;2.2.0: not found
:: thirdparty_tools#saxon-xpath;2.2.0: not found
:: thirdparty_tools#saxon;2.2.0: not found
:: thirdparty_tools#xbean;2.2.0: not found
:: thirdparty_tools#xbean_xpath;2.2.0: not found
:: thirdparty_tools#xmlpublic;2.2.0: not found
::::::::::::::::::::::::::::::::::::::::::::::
问题似乎与这种模式有关:
WARN: ==== public: tried
WARN: http //localhost:8081/nexus/content/groups/public/thirdparty_tools/jsr173_api/2.2.0/jsr173_api-2.2.0.pom
WARN: -- artifact thirdparty_tools#jsr173_api;2.2.0!jsr173_api.jar:
WARN: http //localhost:8081/nexus/content/groups/public/thirdparty_tools/jsr173_api/2.2.0/jsr173_api-2.2.0.jar
ivy seems to be looking for the jsr173_api artifact under its own name, rather than under the xmlbeans folder where it was published to:
[ivy:publish] published jsr173_api to http //localhost:8081/nexus/content/repositories/thirdparty/thirdparty_tools/xmlbeans/2.2.0/jsr173_api-2.2.0.jar
(网址被混淆以防止发生事故)。
所以不知何故,我需要以不同的方式发布,或以不同的方式检索。非常感谢您的想法和建议。