Launch Gradle from Ant

Gradle isn't particularly troublesome to call from the command line, but when booted from an IDE like Eclipse (for example, Buildship's Eclipse Plug-ins for Gradle), it has the following problems:

――It's very difficult to understand because even tasks that you don't normally need appear in the list. --Two files, gradlew and gradlew.bat, are created at the root of the project.

So, rather, I came up with the idea that Ant, which has the best support in the Java IDE, should be used instead of the task runner. That's why I made the following script.

build.ant


<project name="testapp">

  <target name="jar">
    <gradlew command="jar" />
  </target>

  <macrodef name="gradlew">
    <attribute name="command" />
    <sequential>
      <java classname="org.gradle.wrapper.GradleWrapperMain" fork="true"
        classpath="gradle/wrapper/gradle-wrapper.jar">
        <sysproperty key="org.gradle.appname" value="${basedir}" />
        <arg value="@{command}" />
      </java>
    </sequential>
  </macrodef>
</project>

I don't think I'm overwhelmed, but Ivy has stopped updating, and I don't need any extra startup files, so maybe this is fine ...

Recommended Posts

Launch Gradle from Ant
Launch SonarQube from Gradle
Using Docker from Java Gradle
Gradle
How to run Ant in Gradle