Build.xml showing error in eclipse when depending on gradle task

Hi I am currently in the process of coverting most of our old build scripts from ant to gradle.
We have a legacy ant target that we wanted to avoid rewriting.

I can get the project to build but in eclipse the build.xml file always shows that there is an error.
Error is “target unzipCougaar does not exist in this project.”

Line affected in build.xml.

<target name="csi-defrunner" depends="clean-assets, unzipCougaar, set-paths" description="Generates asset classes if necessary">

Gradle Build File

ant.importBuild 'build.xml'
ant.version = version
ant.branchId = "trunk"
ant.buildDate = buildDate

task unzipCougaar(type: Copy) {
into 'build/cougaar'  

Is there something specific I need to do so that the build.xml file knows about the gradle task. I thought that this line was what accomplished this.

  ant.importbuild 'build.xml'

Is this maybe just an eclipse problem? The build seems to work fine and it runs properly.

Eclipse Luna
Gradle 2.4
Java 8
ant 1.9.4
ivy 2.4.0

Any help would be appreciated.

Thanks, Brian

I think you’re saying ‘unzipCougaar’ only exists in the Gradle build and the Ant build.xml references it?

The import only goes one way. Gradle can read the Ant build.xml and generate tasks from it, but Ant by itself won’t know about the Gradle tasks. I imagine Eclipse is doing some sanity checking on the Ant build.xml and notices that there are missing tasks that only exist in Gradle.

You could define ‘unzipCougaar’ as an empty task in Ant and then have Gradle add more behavior to it. Or define an ‘antUnzipCougaar’ task in Ant and have Gradle add a dependency to the real ‘unzipCougaar’. I think either option would get rid of the error in Eclipse.

Either way, your Ant build isn’t usable by itself if it depends on Gradle tasks.

OK that makes sense. Thanks for the Help.

In the end I just ended up re-writing the ant target as a gradle task as that seemed like the cleanest solution.

Thanks, Brian