Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

" Error Compilation error: encoded string too long:" when making a build

Tags:

grails

groovy

war

I have a Grails project that is running correctly in dev mode but when I try to create a war file it gives me following message and stops the build

| Compiling 1 source files
| Compiling 1 source files.
| Compiling 1 source files..
| Compiling 1 source files...
| Compiling 1 source files....
| Compiling 1 source files.....
| Compiling 16 GSP files for package [ProjectName]
| Compiling 16 GSP files for package [ProjectName].
| Error Compilation error: encoded string too long: 108421 bytes

Grails doesn't give me any other info in terms of which GSP or line has the problem, anyone seen this happening?

Here are the grails stats, I would say its a fairly small project

+----------------------+-------+-------+
| Name                 | Files |  LOC  |
+----------------------+-------+-------+
| Controllers          |     6 |   624 | 
| Domain Classes       |     6 |   109 | 
| Java Helpers         |     1 |    96 | 
| Unit Tests           |    12 |   565 | 
| Scripts              |     1 |     4 | 
+----------------------+-------+-------+
| Totals               |    26 |  1398 | 
+----------------------+-------+-------+
like image 761
Sap Avatar asked Oct 08 '22 13:10

Sap


1 Answers

It seems this is grails bug with versions prior to 2.3.7 but it's fixed in 2.3.7 and above. You have two options upgrade or follow the below steps

  1. Find all the gsp pages with file size greater than 64K.
  2. Add <% /* comment to break the static gsp block */ %> to the middle of your static pages (add it to the end of html tags, for example after </P> etc).

This will make grails think that it's processing two chunks and allows it to get processed.

like image 69
grepit Avatar answered Oct 26 '22 23:10

grepit