从我的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/>
有任何想法吗?提前致谢!