到目前为止,我只在构建中生成dist/imasUtils.jar
文件(使用Ant),并使用以下Ant代码对其进行公开:
<ivy:resolve/>
<ivy:publish resolver="imas-ssh" overwrite="true" publishivy="true">
<artifacts pattern="dist/[artifact].[ext]"/>
</ivy:publish>
到目前为止,这有效,但现在我想发布源代码,所以我也在生成dist/imasUtils_src.zip
。 According to my understanding of the ivy manual,我可以这样做:
<ivy:resolve/>
<ivy:publish resolver="imas-ssh" overwrite="true" publishivy="true">
<artifacts pattern="dist/[artifact](_[type]).[ext]"/>
</ivy:publish>
这会识别我的文件dist/imasUtils.jar
和dist/imasUtils_src.zip
,唯一的区别是当我发布它们时,jar文件的type
属性为null
相反,我收到以下错误消息:
/[myDirectory]/build.xml:119: impossible to publish artifacts for net.conselldemallorca.imas#imasUtils;1.2.0:
java.io.IOException: missing artifact net.conselldemallorca.imas#imasUtils;1.2.0!imasUtils.jar
at org.apache.ivy.core.publish.PublishEngine.publish(PublishEngine.java:225)
at org.apache.ivy.core.publish.PublishEngine.publish(PublishEngine.java:172)
at org.apache.ivy.Ivy.publish(Ivy.java:621)
at org.apache.ivy.ant.IvyPublish.doExecute(IvyPublish.java:311)
at org.apache.ivy.ant.IvyTask.execute(IvyTask.java:271)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
...
我的ivy.xml
文件:
<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="net.conselldemallorca.imas"
module="imasUtils" revision="${ivy.revision}"/>
<publications>
<artifact />
</publications>
</ivy-module>
和我的组织ivy-settings.xml
文件:
<ivysettings>
<property name="ivy.pattern" value="artifacts/[organisation]/[module]/r[revision]/ivy-[revision].xml" override="false"/>
<property name="artifact.pattern" value="artifacts/[organisation]/[module]/r[revision]/[artifact].[ext]" override="false"/>
<settings defaultResolver="shared"/>
<resolvers>
<ssh name="imas-ssh" host="MYHOST" publishPermissions="0770">
<ivy pattern="/var/www/html/Ivy/${ivy.pattern}"/>
<artifact pattern="/var/www/html/Ivy/${artifact.pattern}"/>
</ssh>
<chain name="shared">
<url name="imas">
<ivy pattern="http://ivy.proves.imasmallorca.net/Ivy/${ivy.pattern}"/>
<artifact pattern="http://ivy.proves.imasmallorca.net/Ivy/${artifact.pattern}"/>
</url>
<ibiblio name="public" m2compatible="true"/>
</chain>
</resolvers>
</ivysettings>
我正在使用Apache Ant 1.9.3和Ivy 2.4.0
答案 0 :(得分:3)
我怀疑问题可能就是你定义&#34;类型&#34;在模式中。您还需要在常春藤文件的出版物部分声明多个文件。
我建议您对常春藤文件进行以下更改:
<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
<publications>
<artifact name="imasUtils" type="jar"/>
<artifact name="imasUtils" type="zip" e:classifier="src"/>
</publications>
发布任务模式的相应变化:
<ivy:publish .. >
<artifacts pattern="dist/[artifact](_[classifier]).[ext]"/>
</ivy:publish>
&#34;分类器&#34;是自定义extra attribute的示例。
示例:
以下链接提供了有关常春藤如何与Maven repos进行交互的更多解释,后者对a&#34;来源&#34;属性。