Juan Acevedo
Juan Acevedo

Reputation: 1788

Gradle compileGroovy java.lang.ExceptionInInitializerError

Here is the github repo: https://github.com/entrpn/gradle_plugin. You will need to manually create a folder "repo" at the root of the project since git doesn't add empty directories. That is where the generated files are supposed to go when running:

./gradlew uploadArchives

I am trying to write a simple gradle plugin following this tutorial https://afterecho.uk/blog/create-a-standalone-gradle-plugin-for-android-a-step-by-step-guide.html and when I get to the part where I am trying to create the local maven repo, I am not able to.

Problem: I am using the gradle wrapper command line:

./gradlew uploadArchives

and I receive the above error. Anyone know what I am doing wrong. Here is the log output:

Executing org.gradle.api.internal.tasks.compile.ApiGroovyCompiler in worker daemon. 16:20:23.624 [INFO] [org.gradle.workers.internal.WorkerDaemonServer] Exception executing org.gradle.api.internal.tasks.compile.ApiGroovyCompiler in worker daemon: java.lang.ExceptionInInitializerError. 16:20:23.636 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationWorkerRegistry] Worker root.2.3 completed (1 in use) 16:20:23.636 [DEBUG] [org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter] Removed task artifact state for {} from context. 16:20:23.636 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':compileGroovy'

Thank you.

Upvotes: 3

Views: 2840

Answers (2)

Juan Acevedo
Juan Acevedo

Reputation: 1788

Ok I figured it out. Jason's answer gave me a clue. I opened terminal and ran ./gradlew --version and got this output:


Gradle 3.5-rc-2

Build time: 2017-03-27 15:56:23 UTC Revision: ec63970cd167993d3dcda346a1d00a286a23b1c9

Groovy: 2.4.10 Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015 JVM: 1.8.0_131 (Oracle Corporation 25.131-b11) OS: Mac OS X 10.12.6 x86_64

So I noticed the Groovy version is 2.4.10 so I changed the gradle file to use this version, recompiled and the files were generated.

Upvotes: 4

Jason Heithoff
Jason Heithoff

Reputation: 518

When I tried to run it I received the following error in addition to yours,

When I tried to run it I received the following error, "Caused by: groovy.lang.GroovyRuntimeException: Conflicting module versions. Module [groovy-all is loaded in version 2.4.7 and you are trying to load version 2.3.11"

I modified build.gradle and changed line 14 from

compile 'org.codehaus.groovy:groovy-all:2.3.11'

to

compile 'org.codehaus.groovy:groovy-all:2.4.7'

Upvotes: 2

Related Questions