[英]Convert ivy.xml to pom.xml
I have a ivy.xml - https://gist.github.com/1898060 I also have the jar file related to this ivy.xml. 我有一个ivy.xml - https://gist.github.com/1898060我也有与这个ivy.xml相关的jar文件。 What i need is a mechanism to import this project to my maven repo and use it in my maven project.
我需要的是一个机制,将这个项目导入我的maven仓库并在我的maven项目中使用它。 SO basically if i am able to convert the ivy.xml to pom.xml , i might be able to get it work.
所以基本上如果我能够将ivy.xml转换为pom.xml,我可能能够让它工作。 Is there some mechanism through which i can achieve this.
是否有一些机制可以实现这一目标。 I am looking for something like a maven plugin to accomplish this task.
我正在寻找像maven插件这样的东西来完成这项任务。 I know that there are ways we can edit the ivy.xml and build.xml to achieve this but then i dont want to do it , as the project is in a private repo.
我知道有一些方法可以编辑ivy.xml和build.xml来实现这一点,但后来我不想这样做,因为该项目是在一个私人仓库中。
What you really need to do is publish the jars built by ANT project into your Maven repository. 您真正需要做的是将ANT项目构建的jar发布到Maven存储库中。
ant -Dproject.version=0.9.0-local-20120211095554 clean publish
I know you don't want to change the ANT build, but creating an extra "publish" target will properly integrate your ANT and Maven projects. 我知道您不想更改ANT版本,但创建额外的“发布”目标将正确集成您的ANT和Maven项目。
The two jar artifacts, published by your modified ANT build, could be consumed normally as follows: 由修改后的ANT构建发布的两个jar工件可以正常使用,如下所示:
<dependency>
<groupId>com.opengamma</groupId>
<artifactId>og-analytics</artifactId>
<version>0.9.0-local-20120211095554</version>
</dependency>
<dependency>
<groupId>com.opengamma</groupId>
<artifactId>og-analytics</artifactId>
<version>0.9.0-local-20120211095554</version>
<classifier>sources</classifier>
</dependency>
Main changes are to your publications section: 主要变化是您的出版物部分:
<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
<info organisation="com.opengamma" module="og-analytics"/>
<publications>
<artifact name="og-analytics" type="jar"/>
<artifact name="og-analytics" type="pom"/>
<artifact name="og-analytics" type="jar" e:classifier="sources"/>
</publications>
<dependencies>
<dependency name="og-util" rev="0.9.0-local-20120211095525" revConstraint="latest.integration"/>
<dependency org="org.jfree" name="jfreechart" rev="1.0.13"/>
<dependency org="cern" name="colt" rev="1.2.0"/>
<dependency org="cern" name="parallelcolt" rev="0.9.1"/>
<dependency org="latexlet" name="latexlet" rev="1.11"/>
<dependency org="org.apache.commons" name="commons-math" rev="2.1"/>
<dependency org="it.dexy" name="json-doclet" rev="0.3.1"/>
<dependency org="org.json" name="simple" rev="1.1"/>
<exclude org="org.junit"/>
</dependencies>
</ivy-module>
Notes: 笔记:
<target name="prepare" description="Generate POM">
<fail message="Unset property: project.version" unless="project.version"/>
<ivy:deliver deliverpattern="${build.dir}/ivy.xml" pubrevision="${project.version}" status="release"/>
<ivy:makepom ivyfile="${build.dir}/ivy.xml" pomfile="${build.dir}/${ivy.module}.pom"/>
</target>
<target name="publish" depends="build,prepare" description="Upload to Nexus">
<ivy:publish resolver="nexus-deploy" pubrevision="${project.version}" overwrite="true" publishivy="false" >
<artifacts pattern="${build.dir}/[artifact](-[classifier]).[ext]"/>
</ivy:publish>
</target>
Notes: 笔记:
This is where you configure the location of the repositories and credentials to be used by publish build target. 您可以在此配置发布构建目标使用的存储库和凭据的位置。
<ivysettings>
<settings defaultResolver="nexus-central"/>
<credentials host="somehost" realm="Sonatype Nexus Repository Manager" username="????" passwd="????"/>
<resolvers>
<ibiblio name="nexus-central" root="http://somehost/nexus/content/repositories/central/" m2compatible="true"/>
<ibiblio name="nexus-deploy" root="http://somehost/nexus/content/repositories/repo" m2compatible="true"/>
</resolvers>
</ivysettings>
Notes: 笔记:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.