I am working on a proof of concept to convert an inhouse Ant build over to Gradle. The existing build uses PATHs and references extensively and I am getting a null when a path defined in an imported Ant file is tried to be used by the Javac Ant task.
I have a primary build and through the magic of the settings.gradle file I am calling sub-builds.
In the sub-build I am importing a build file that defines lots of useful paths so that I can change them in only one place and re-use them everywhere else.
ant.importBuild '../build-imports.xml'
I’m then making a Groovy variable out of it.
String basePath = ant.properties['base.path']
Here is my Javac line from the build:
ant.javac(srcDir: "${compileSourcecode}", destDir: "WebContent/WEB-INF/classes", source: "${compileSourceversion}", target: "${compileTargetversion}", verbose: "${compileVerbose}", debug: "${compileDebug}", deprecation: "${compileDeprecation}", optimize: "${compileOptimize}", classpathref: "${basePath}", includeAntRuntime: "${compileIncludeAntRuntime}")
The basePath variable is null instead of containing my nicely defined path.
The path in question looks like this:
<path id="base.path">
<pathelement location="ApacheCommons/commons-lang/commons-lang.jar" />
<pathelement location="log4j/log4j.jar" />
<pathelement location="Acme/acme.jar" />
<fileset dir="." erroronmissingdir="false">
<include name="**/*.jar"/>
</fileset>
<fileset dir="../../${project.name}Model" erroronmissingdir="false">
<include name="**/${project.name}Model.jar"/>
</fileset>
<fileset dir="../../${project.name}Persistance" erroronmissingdir="false">
<include name="**/${project.name}Persistance.jar"/>
</fileset>
<fileset dir="../../${project.name}Service" erroronmissingdir="false">
<include name="**/${project.name}Service.jar"/>
</fileset>
<path refid="server.path" />
</path>
So how do I make this Gradle’ish? I haven’t found anything in either the Gradle userguide or the Oreilly Gradle book. Perhaps I’m just not using the right keywords?