用两天的时间研究了下ivy和ant,大致可以用了。其中ivy发布snapshots到nexus的资料比较少,mark一下。

关键一点是resolvers配置,如下:

 

<resolvers>
<ibiblio name="snapshots" m2compatible="true" usepoms="true"
root="${nexus-snapshots}"
pattern="[organisation]/[module]/[revision]/[artifact]-*(-[classifier])-snapshots.[ext]" />
</resolvers>

要注意的是*号,不能加改为revision,我试验过,改为*号,可以发布,不知道什麽原因,不然报400错误。

 

ant任务配置如下:

 

<target name="publish-snapshots" depends="clean-build, jar">  
<ivy:makepom ivyfile="ivy.xml" pomfile="${build.dir}/${ivy.module}.pom" />
<ivy:publish artifactspattern="${build.dir}/[artifact].[ext]"
resolver="snapshots" overwrite="true" update="true" forcedeliver="true" />
<echo
message="project ${ant.project.name} released with version ${reversion}" />
</target>