0
votes

I have been learning Groovy/Grails Tool Suite (GGTS) 3.6.4, with Grails 2.4.4 using some video tutorials. When I attempt to package the project into an application using the grails war command on the Windows command prompt, I get the following error:

"Error Gradle build terminated with error: Task 'assemble' not found in root project ..."

Any references to this error that I have found online have only involved Android Studio (for instance), so I am at a loss here as to how to fix it for GGTS.

I have Android Studio 1.0.1 installed, and in case it was affecting the Grails packaging, I tried the solution of removing the <component name="FacetManager"> from the general Android Studio "MyApplication.iml" file, but that had no effect. I couldn't find any analogous file for the GGTS.

In case the issue lies elsewhere in my overall installation, I have Java JRE 7_79 (64-bit) installed, as well as the the JDK 1.7.0_79 (64-bit)

1
What is "Groovy/Grails 3.6.4"? - tim_yates
Groovy is a code related to Java & Ruby. Grails is the framework that it runs on. Groovy/Grails 3.6.4 is the latest version of the IDE tool suite for developing with these to create mobile apps. - PellucidWombat
Any luck attempting adding a dummy assemble task as per code.google.com/p/android/issues/detail?id=57229#c7? - JcT

1 Answers

2
votes

OK. I found out what the cause of the error was, and how to avoid it in the future.

The Problem

Grails 3.0.1 requires the following files for grails war to work:

  • build.gradle
  • gradle.properties
  • gradlew
  • gradlew.bat
  • \gradle (directory)

Grails 2.4.4 does not require any of the above files for making a WAR file.

GGTS 3.6.4 does not work with Grails 3.0.1, but it comes with and works fine with Grails 2.4.4.

The Solution

Copying the stated Gradle files & directory to a GGTS project folder fixed the problem. However, I wasn't satisfied with needing to do this manually or with a custom batch file for every project.

Looking deeper, it turns out that when working out compatibility issues between the Java 32-bit JRE existing on my system and the Java 64-bit JRE & SDK, Grails, and GGTS versions (there was a lot of fiddling to get things working), at one point I had set up my global variable to Grails to be directed at 3.0.1, and I failed to update it to Grails 2.4.4. Making this change has fixed the issue.

Explaining the Cause

When following this video series on installing a compatible set of Java, Grails, and GGTS, the instructor manually downloaded the latest version of Grails from the Grails site and then downloaded GGTS separately from its own site. Both of these were older versions than what I was working with.

In my case it turns out that, after setting up the Java SDK & Grails, the latest version of GGTS (3.6.4) did not work properly with the latest version of Grails (3.0.1). Fortunately the GGTS bundle came with an older version of Grails (2.4.4), and by referencing that, GGTS would work correctly. However, although I changed the IDE reference to Grails, I forgot to reset my environment variable ...

So GGTS was setting up the project for using Grails 2.4.4. However, when calling grails war, the command was using Grails 3.0.1! Apparently these two versions of Grails use different files for creating a WAR file, so GGTS was not setting up the project directories with the correct local files, and the packaging was failing.

Avoiding Future Occurrences

So, when using GGTS 3.6.4, make sure that all references to Grails point to Grails 2.4.4.

In general, if any GGTS bundle contains a version of Grails, you should have everything set up to use that version, even if it is old.