我已经将此线程中列出的示例更进了一步,并创建了一个macrodef来清理一些东西以便重复使用.请参阅下文,了解从nexus下载两个工件(一个快照,一个版本).
<project>
<target name="get-all">
<mkdir dir="lib" />
<nexus-get
groupId="foo.bar"
artifactId="some-artifact"
version="1.0.28"
repo="releases"
extension="jar"
dest="lib"
/>
<nexus-get
groupId="foo.bar"
artifactId="another-artifact"
version="1.0.0-SNAPSHOT"
repo="snapshots"
extension="jar"
dest="lib"
/>
</target>
<macrodef name="nexus-get">
<attribute name="groupId"/>
<attribute name="artifactId"/>
<attribute name="version"/>
<attribute name="repo"/>
<attribute name="extension"/>
<attribute name="dest"/>
<sequential>
<get src="http://my-nexus:9999/nexus/service/local/artifact/maven/redirect?r=@{repo}&g=@{groupId}&a=@{artifactId}&v=@{version}&e=@{extension}" dest="@{dest}/@{artifactId}.@{extension}" usetimestamp="true" />
</sequential>
</macrodef>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13801 次 |
| 最近记录: |