使用Ant构建工具从关系下载罐子在Maven的自动完成 [英] Download jars from nexus using ant build tool as done automatically in Maven

查看:224
本文介绍了使用Ant构建工具从关系下载罐子在Maven的自动完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个build.xml(蚂蚁为基础),需要从一些关系罐子现有lib文件夹中得到复制。即当它建立应该从关系与定义&放一些版本复制的jar;然后在LIB和放大器复印件;做编辑。
像Maven的发生,我们定义神器&放大器;它的版本。如果更改会自动从Maven的回购下载。
我如何能够在基于蚂蚁为此建立?

I have a build.xml(ant based) which requires some jar from nexus to get copied in existing lib folder. i.e when it builds it should copy the jar from nexus with some version defined & then copy in lib & do compilation. like happen in maven we define the artifact & its version . If changed will automatically download it from maven repo. how can i do this in ant based builds?

专家请咨询。

推荐答案

我已在这个线程一步上市的例子,并创建了一个macrodef清理了一点东西进行再利用。请参阅下面有从Nexus Two的工件(一个快照,一个发行版本)。

I have taken the example listed in this thread one step further and created a macrodef to clean things up a bit for re-use. See below for downloading two artifacts from nexus (one snapshot, one release).

<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}&amp;g=@{groupId}&amp;a=@{artifactId}&amp;v=@{version}&amp;e=@{extension}" dest="@{dest}/@{artifactId}.@{extension}" usetimestamp="true" />
    </sequential>
</macrodef>

这篇关于使用Ant构建工具从关系下载罐子在Maven的自动完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆