运行ant时,如何通过命令行传递默认值


<target name="clone-repo" description="Pull code from SCM repository" depends="resolve">
<taskdef resource="org/eclipse/jgit/ant/ant-tasks.properties" classpathref="build.path"/>
<delete dir="${basedir}/omoc_build"/>
<git-clone uri="https://user:******@github.com/sirect/omoc.git" dest="${basedir}/omoc_build" branch="${branch}" />
<zip destfile="${basedir}/devtoolkit/devtoolkit_docker/config.zip" basedir="${basedir}/omoc_build/config" />

我想运行ant命令,默认情况下它应该从主分支克隆

没什么!要回答您的问题,您可以在属性文件中设置branch属性,如果您在命令行上指定,该属性将被覆盖。包括目标上方的属性文件:

<property file="defaults.properties" description="default configuration."/>

defaults.properties中,您将把branch设置为main,并且您可以用-Dbranch=non-main-branch覆盖它

这允许您设置默认值。

现在,对于您没有征求的建议:不要让蚂蚁克隆你的来源。你应该让你的构建系统检查源代码,然后ant应该构建源代码。你在这里制造了一个鸡和蛋的问题。。。build.xml在源代码管理中,它正在检查源代码?这很可疑。

最新更新