gpt4 book ai didi

java - Ivy 不会发布到我的本地存储库

转载 作者:行者123 更新时间:2023-11-30 04:14:06 24 4
gpt4 key购买 nike

来 self 的build.xml:

<?xml version="1.0" encoding="utf-8" ?>
<project name="myapp" default="package-core" basedir=".."
xmlns:ivy="antlib:org.apache.ivy.ant"
xmlns:antcontrib="antlib:net.sf.antcontrib">
<target name="bootstrap">
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant" classpathref="build.path"/>
</target>

<target name="resolve" depends="bootstrap">
<ivy:settings url="${ivy.settings.home}"/>
<ivy:cleancache/>
<ivy:resolve file="build/${ivy.xml}"/>
<ivy:retrieve pattern="${gen.lib.main.dir}/[artifact]-[revision].[ext]" conf="main"/>
<ivy:report todir="${gen.staging.dir}" />
</target>

...omitted for brevity

<target name="publish" depends="compile">
<ivy:publish resolver="default-resolver" pubrevision="0.2.0" overwrite="true" update="true">
<artifacts pattern="${gen.dist.pub.dir}/[artifact].[ext]" />
</ivy:publish>
</target>

我的ivy.xml:

<?xml version="1.0" encoding="UTF-8"?>  
<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="myapp" module="myapp"/>
<configurations>
<conf name="main" description="provides main dependencies for the client JAR"/>
</configurations>
<dependencies>
<!-- Main dependencies. -->
<dependency org="google" name="guava" rev="14.0" conf="main->*"/>
<dependency org="google" name="guice" rev="3.0" conf="main->*"/>
</dependencies>
</ivy-module>

我的ivy-settings.xml:

<ivysettings>  
<properties file="ivy-settings.properties"/>
<settings defaultResolver="default-resolver"/>
<latest-strategies>
<latest-lexico/>
</latest-strategies>
<credentials host="${ivy.repo.root}" realm="${ivy.std.repo.realm}"
username="${ivy.std.repo.username}" password="${ivy.std.repo.password}"/>
<resolvers>
<chain name="default-resolver" returnFirst="true">
<url name="std-repo">
<ivy pattern="${ivy.repo.root}/${ivy.module.pattern}"/>
<artifact pattern="${ivy.repo.root}/${ivy.artifact.pattern}"/>
</url>
</chain>
</resolvers>
<modules>
<module organisation="myapp" name="*" resolver="default-resolver"/>
</modules>
</ivysettings>

问题:

当我运行 resolve 目标时,我成功下载了 Guava 和 Guice JAR(及其所有依赖项)。所以我知道我已经设置好了,至少部分正确。

但是当我运行 publish 目标时,出现以下错误:

[jar] Building jar: /home/myuser/sandbox/dsi/workbench/eclipse/workspace/myapp/gen/dist/myapp-server
publish:
[ivy:publish] :: loading settings :: url = jar:file:/home/myuser/sandbox/dsi/workbench/eclipse/4.2/eclipse/plugins/org.apache.ivy.eclipse.ant_2.3.0.final_20130110142753/ivy.jar!/org/apache/ivy/core/settings/ivysettings.xml

BUILD FAILED
/home/myuser/sandbox/dsi/workbench/eclipse/workspace/myapp/build/build-core.xml:289: no organisation provided for ivy publish task: It can either be set explicitely via the attribute 'organisation' or via 'ivy.organisation' property or a prior call to <resolve/>

有什么想法吗?提前致谢!

最佳答案

您必须在同一个 Ant session 中调用“发布”和“解析”。如果您单独调用它们,它将不起作用,并且您会收到此错误消息。

例如,您可以让“发布”目标依赖于“解决”目标:

<target name="publish" depends="resolve,compile">
...
</target>

希望这有帮助,马丁

关于java - Ivy 不会发布到我的本地存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18872504/

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