Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
186 views
in Technique[技术] by (71.8m points)

java - Automate ivy revision increase for all my projects using ant script

i own 20 ivy projects out of 50 other projects(owned by others), i use some versions of their binaries in my projects.

Issue is during release, i have to manually increase the version of my 20 ivy files, checkin the files and build the binaries. which is time consuming. though eclipse find and replace helps.

steps to automate using ant:

1) checkout the ivy files alone. 2) using scripts/logic to change the version for only my modules/my modules dependency with one another. 3) check in the files. 4) tag the branch for release.

Stuck at step 2 rest all are relatively easy.

Tried xml task, but facing challenges on searching as we dont know the exact index some times.

Appreciate your help.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Have you considered using the dynamic revision numbers in your ivy files?

<dependency org="myorg" name="myname1" revision="latest.release"/>
<dependency org="myorg" name="myname2" revision="latest.integration"/>

Ivy will cleverly resolve these dependencies in the ivy.xml file that is published to ivy repositories.

Use ivy to generate buildnumber

The buildnumber is a very clever task that generates the next number in a sequence, based on the versions you've already been published.

Controlling the build order

Another ivy multi-module tip is to use buildlist task to control the order in which your modules are built. It works based on the inter-dependencies declared in the ivy files of each sub-module. This ensures that the latest.release and latest.integration revisions will find the expected revision.

Resolving the dynamic revisions

As I've said this is normally done automatically, but sometimes you'll need to actually see the real versions used, for example when generating a Maven POM file (when publishing to a Maven repo).

The following examples use the ivy deliver and makepom tasks to create a Maven POM with the dynamic revisions expanded.

<target name="generate-pom">
    <ivy:deliver deliverpattern="${build.dir}/ivy.xml" pubrevision="${publish.revision}" status="${publish.status}"/>
    <ivy:makepom ivyfile="${build.dir}/ivy.xml" pomfile="${build.dir}/${ivy.module}.pom"/>
</target>

<target name="publish" depends="build,generate-pom">
    <ivy:publish resolver="${publish.resolver}" pubrevision="${publish.revision}" overwrite="true" publishivy="false" >
        <artifacts pattern="${build.dir}/[artifact](-[classifier]).[ext]"/>
    </ivy:publish>
</target>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...