In my development I have 2 projects that share common classes, which are in a third project. I also have a continues integration server. All projects are build on it and later deployed.
I found that Apache Ivy best suites my need. The reasons for this are:
- it does integrate with Ant.
- it takes minimum intervention into the project to use Ivy.
- it has tutorials and good documentation.
What I like is that in default configuration Ivy offers you a local repository. All you have to do is write an ivy.xml file, which describes your project and dependencies and modify build.xml.
In my situation I write the ivy.xml, that describes the shared project like this:
<ivy-module version="2.0">
<info organisation="my" module="common"/>
<publications>
<artifact name="common" type="jar" />
</publications>
</ivy-module>
And modified build.xml to publish project like this:
<!-- =================================
target: publish-local
================================= -->
<target name="publish-local" depends="jar" description="--> publish this project in the local ivy repository">
<tstamp>
<format property="now" pattern="yyyyMMddHHmmss" />
</tstamp>
<ivy:publish artifactspattern="${dist.dir}/[artifact].[ext]" resolver="local" pubrevision="${version}" pubdate="${now}" forcedeliver="true" />
<echo message="project ${ant.project.name} published locally with version ${version}" />
<ivy:cleancache />
</target>
In my other projects which depends on a "common.jar" I write the following ivy.xml:
<ivy-module version="2.0">
<info organisation="my" module="booking"/>
<dependencies>
<dependency name="common" rev="latest.integration" />
</dependencies>
</ivy-module>
And modified the build.xml like this:
<!-- =================================
target: resolve
================================= -->
<target name="resolve" depends="clean, clean-cache">
<ivy:retrieve />
</target>
That is all.
One more thing. You can use Ivy in Eclipse. For this one can download plugin IvyDE.
Комментариев нет:
Отправить комментарий