Building other, dependent projects with Ant

后端 未结 1 494
别那么骄傲
别那么骄傲 2020-12-17 05:38

Let me preface by saying that I am new to Ant. As in, I just started learning it 2 days ago in order to accomplish this task.

What I\'m trying to do is create a \"m

相关标签:
1条回答
  • 2020-12-17 06:06

    Here are some general guidelines (not rules, Ant is quite liberal):

    • a build.xml is generally designed to be run on a specific project, so it is not 'imported' in other builds
    • the import task is generally used to share some comme piece of build mechanic, not a piece of build workflow like you are doing. For instance a target to build jar, parameterized by some properties like the target directory.
    • the subant and ant tasks are preferred used to trigger builds of other project

    So here is what would look like a build.xml for project D:

    <project name="CommonJava" default="makeCommonJavaJar" basedir=".">
    
        <target name="build-deps">
            <ant antfile="../Common/build.xml" target="makeCommonJar"/>
            <ant antfile="../CommonAndroid/build.xml" target="makeAndroidJar"/>
        </target>
    
        <target name="makeCommonJavaJar" depends="build-deps">
            <mkdir dir="build" />
            <jar jarfile="./build/commonjava.jar" includes="*.class" />
        </target>
    
    </project>
    

    See http://ant.apache.org/manual/Tasks/ant.html

    0 讨论(0)
提交回复
热议问题