使用供应商 jar 的本地常春藤解决方案
Use local Ivy resolution with vendor jars
我有来自 IBM 的供应商 jar(4 个以 com.ibm.mq* 开头的 jar)
我正在尝试将它们发布到我本地的常春藤缓存中以用于多个项目。
IVY.XML
<ivy-module version="2.0">
<info organisation="com.ibm" module="com.ibm.mq" />
<publications>
<artifact name="com.ibm.mq" type="jar" ext="jar"/>
<artifact name="com.ibm.mq" type="javadoc" ext="jar"/>
<artifact name="com.ibm.mq" type="source" ext="jar"/>
<artifact name="com.ibm.mq.commonservices" type="jar" ext="jar"/>
<artifact name="com.ibm.mq.commonservices" type="javadoc" ext="jar"/>
<artifact name="com.ibm.mq.commonservices" type="source" ext="jar"/>
<artifact name="com.ibm.mq.headers" type="jar" ext="jar"/>
<artifact name="com.ibm.mq.headers" type="javadoc" ext="jar"/>
<artifact name="com.ibm.mq.headers" type="source" ext="jar"/>
<artifact name="com.ibm.mq.jmqi" type="jar" ext="jar"/>
<artifact name="com.ibm.mq.jmqi" type="javadoc" ext="jar"/>
<artifact name="com.ibm.mq.jmqi" type="source" ext="jar"/>
</publications>
<dependencies>
</dependencies>
</ivy-module>
我的罐子被命名为:
laptop: ls jars | sed 's/^/ /'
com.ibm.mq-7.5.0.2.jar
com.ibm.mq.commonservices-7.5.0.2.jar
com.ibm.mq.headers-7.5.0.2.jar
com.ibm.mq.jmqi-7.5.0.2.jar
但是发布失败:
Buildfile: C:\Users\alan\Workspace-Eclipse\IBM-MQ\build.xml
publish:
[ivy:resolve] :: Ivy 2.2.0 - 20100923230623 :: http://ant.apache.org/ivy/ ::
[ivy:resolve] :: loading settings :: url = jar:file:/C:/Users/alan/.ant/lib/ivy-2.2.0.jar!/org/apache/ivy/core/settings/ivysettings.xml
[ivy:resolve] :: resolving dependencies :: com.ibm#com.ibm.mq;working@DTC26009BA481FC
[ivy:resolve] confs: [default]
[ivy:resolve] :: resolution report :: resolve 52ms :: artifacts dl 0ms
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| default | 0 | 0 | 0 | 0 || 0 | 0 |
---------------------------------------------------------------------
[ivy:publish] :: publishing :: com.ibm#com.ibm.mq
BUILD FAILED
C:\Users\jurgenaw\Workspace-Eclipse\IBM-MQ\build.xml:4: impossible to publish artifacts for com.ibm#com.ibm.mq;working@DTC26009BA481FC: java.io.IOException: missing artifact com.ibm#mq;7.5.0.2!mq.jar
at org.apache.ivy.core.publish.PublishEngine.publish(PublishEngine.java:225)
我的build.xml文件:
<project name="localrepository" default="publish" xmlns:ivy="antlib:org.apache.ivy.ant">
<target name="publish" description="Publish ibm.mq jars into LOCAL repository">
<ivy:resolve/>
<ivy:publish pubrevision="7.5.0.2" status="release" resolver="local" overwrite="true" >
<!-- artifacts pattern="[artifact]-[type].[ext]"/ -->
<artifacts pattern="[type]s/[artifact]-[revision].[ext]" />
</ivy:publish>
</target>
<target name="cleancache" description="removes home/user/.ivy2 !">
<ivy:cleancache />
</target>
<target name="resolve" description="resolve">
<ivy:resolve />
</target>
<target name="report" description="dependancy report">
<ivy:report organisation="com.ibm" module="com.ibm.mq" />
</target>
</project>
或者您可以使用 filesystem resolver 并避免发布 jars。
- sample example which explain how to use filesystem resolver
我有来自 IBM 的供应商 jar(4 个以 com.ibm.mq* 开头的 jar) 我正在尝试将它们发布到我本地的常春藤缓存中以用于多个项目。
IVY.XML
<ivy-module version="2.0">
<info organisation="com.ibm" module="com.ibm.mq" />
<publications>
<artifact name="com.ibm.mq" type="jar" ext="jar"/>
<artifact name="com.ibm.mq" type="javadoc" ext="jar"/>
<artifact name="com.ibm.mq" type="source" ext="jar"/>
<artifact name="com.ibm.mq.commonservices" type="jar" ext="jar"/>
<artifact name="com.ibm.mq.commonservices" type="javadoc" ext="jar"/>
<artifact name="com.ibm.mq.commonservices" type="source" ext="jar"/>
<artifact name="com.ibm.mq.headers" type="jar" ext="jar"/>
<artifact name="com.ibm.mq.headers" type="javadoc" ext="jar"/>
<artifact name="com.ibm.mq.headers" type="source" ext="jar"/>
<artifact name="com.ibm.mq.jmqi" type="jar" ext="jar"/>
<artifact name="com.ibm.mq.jmqi" type="javadoc" ext="jar"/>
<artifact name="com.ibm.mq.jmqi" type="source" ext="jar"/>
</publications>
<dependencies>
</dependencies>
</ivy-module>
我的罐子被命名为:
laptop: ls jars | sed 's/^/ /'
com.ibm.mq-7.5.0.2.jar
com.ibm.mq.commonservices-7.5.0.2.jar
com.ibm.mq.headers-7.5.0.2.jar
com.ibm.mq.jmqi-7.5.0.2.jar
但是发布失败:
Buildfile: C:\Users\alan\Workspace-Eclipse\IBM-MQ\build.xml
publish:
[ivy:resolve] :: Ivy 2.2.0 - 20100923230623 :: http://ant.apache.org/ivy/ ::
[ivy:resolve] :: loading settings :: url = jar:file:/C:/Users/alan/.ant/lib/ivy-2.2.0.jar!/org/apache/ivy/core/settings/ivysettings.xml
[ivy:resolve] :: resolving dependencies :: com.ibm#com.ibm.mq;working@DTC26009BA481FC
[ivy:resolve] confs: [default]
[ivy:resolve] :: resolution report :: resolve 52ms :: artifacts dl 0ms
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| default | 0 | 0 | 0 | 0 || 0 | 0 |
---------------------------------------------------------------------
[ivy:publish] :: publishing :: com.ibm#com.ibm.mq
BUILD FAILED
C:\Users\jurgenaw\Workspace-Eclipse\IBM-MQ\build.xml:4: impossible to publish artifacts for com.ibm#com.ibm.mq;working@DTC26009BA481FC: java.io.IOException: missing artifact com.ibm#mq;7.5.0.2!mq.jar
at org.apache.ivy.core.publish.PublishEngine.publish(PublishEngine.java:225)
我的build.xml文件:
<project name="localrepository" default="publish" xmlns:ivy="antlib:org.apache.ivy.ant">
<target name="publish" description="Publish ibm.mq jars into LOCAL repository">
<ivy:resolve/>
<ivy:publish pubrevision="7.5.0.2" status="release" resolver="local" overwrite="true" >
<!-- artifacts pattern="[artifact]-[type].[ext]"/ -->
<artifacts pattern="[type]s/[artifact]-[revision].[ext]" />
</ivy:publish>
</target>
<target name="cleancache" description="removes home/user/.ivy2 !">
<ivy:cleancache />
</target>
<target name="resolve" description="resolve">
<ivy:resolve />
</target>
<target name="report" description="dependancy report">
<ivy:report organisation="com.ibm" module="com.ibm.mq" />
</target>
</project>
或者您可以使用 filesystem resolver 并避免发布 jars。
- sample example which explain how to use filesystem resolver