0

I'm trying to use j2html library in my project, but I keep getting this compilation error.

Java version: 1.7

Grails Version: 2.4.3

Gradle dependency added: compile 'com.j2html:j2html:1.2.0'

Imports:

import j2html.tags.ContainerTag
import static j2html.TagCreator.*

Error:

[groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
  [groovyc] General error during semantic analysis: java.lang.NoClassDefFoundError: Unable to load class j2html.TagCreator due to missing dependency java/util/function/Predicate
  [groovyc] 
  [groovyc] java.lang.RuntimeException: java.lang.NoClassDefFoundError: Unable to load class j2html.TagCreator due to missing dependency java/util/function/Predicate
  [groovyc]     at org.codehaus.groovy.control.CompilationUnit.convertUncaughtExceptionToCompilationError(CompilationUnit.java:1083)
  [groovyc]     at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1061)
  [groovyc]     at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:583)
  [groovyc]     at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:561)
  [groovyc]     at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:538)
  [groovyc]     at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:517)
  [groovyc]     at org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:59)
  [groovyc]     at org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:215)
  [groovyc]     at org.codehaus.groovy.ant.Groovyc.runCompiler(Groovyc.java:1161)
  [groovyc]     at org.codehaus.groovy.ant.Groovyc.compile(Groovyc.java:1212)
  [groovyc]     at org.codehaus.groovy.grails.compiler.Grailsc.compile(Grailsc.java:78)
  [groovyc]     at org.codehaus.groovy.ant.Groovyc.execute(Groovyc.java:827)
  [groovyc]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
  [groovyc]     at sun.reflect.GeneratedMethodAccessor97.invoke(Unknown Source)
  [groovyc]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  [groovyc]     at java.lang.reflect.Method.invoke(Method.java:606)

How do I solve this?

Pawel
  • 417
  • 1
  • 6
  • 25
  • Predicates were added in Java 1.8. Is that version of the j2html support 1.7? – Mike Oct 09 '19 at 15:15
  • According to official website Java 6 and 7 support was added since version 1.0.0 https://j2html.com/news.html – Pawel Oct 10 '19 at 12:54
  • I've seen other libraries that did this, and they relied on setting the target version to 1.7, but that was typically for the ide. You may want to look in that direction. – Mike Oct 11 '19 at 11:05
  • I've tried that already, unfortunately no luck ;/ – Pawel Oct 12 '19 at 17:48

0 Answers0