Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8247823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:59:04+00:00 2026-06-07T22:59:04+00:00

I have a Groovy application that is built with Gradle. I can run it

  • 0

I have a Groovy application that is built with Gradle. I can run it correctly with gradle run, but I would like to create a fat JAR to make deployment easier. I have added the instructions

jar {
    dependsOn configurations.runtime
    from { configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) } }
}

to my build.gradle.

It seems that a JAR including a lot of dependencied is generated, but when I try to run it with java -jar myproject.jar, I get the error

Exception in thread "main" java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(Z)V
    at groovy.lang.MetaClassImpl.loadReflector(MetaClassImpl.java:1652)
    at groovy.lang.MetaClassImpl.generateReflector(MetaClassImpl.java:1615)
    at groovy.lang.MetaClassImpl.checkInitialised(MetaClassImpl.java:1532)
    at groovy.lang.MetaClassRegistry.getMetaClass(MetaClassRegistry.java:140)
    at groovy.lang.MetaClassImpl.addNewStaticMethodsFrom(MetaClassImpl.java:1300)
    at groovy.lang.MetaClassImpl.addInheritedMethods(MetaClassImpl.java:201)
    at groovy.lang.MetaClassImpl.checkInitialised(MetaClassImpl.java:1529)
    at groovy.lang.MetaClassRegistry.checkInitialised(MetaClassRegistry.java:201)
    at groovy.lang.MetaClassRegistry.<init>(MetaClassRegistry.java:113)
    at groovy.lang.MetaClassRegistry.<init>(MetaClassRegistry.java:89)
    at org.codehaus.groovy.runtime.Invoker.<init>(Invoker.java:102)
    at org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:80)
    at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToBoolean(DefaultTypeTransformation.java:156)
    at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.booleanUnbox(DefaultTypeTransformation.java:65)
    at mycompany.myproject.Main.main(Main.groovy:6)

More details, if they can help

For reference, here is the full build.gradle:

apply plugin: 'groovy'

project.group = 'mycompany.myproject'
archivesBaseName = 'myproject'
project.version = '0.1'
manifest.mainAttributes('Main-Class' : 'mycompany.myproject.Main')

apply plugin: 'application'
mainClassName = 'mycompany.myproject.Main'

repositories {
    mavenCentral()
}

buildscript {
    apply from: 'https://github.com/valkolovos/gradle_cobertura/raw/master/repo/gradle_cobertura/gradle_cobertura/1.2/coberturainit.gradle'
}

jar {
    dependsOn configurations.runtime
    from { configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) } }
}

dependencies {
    groovy group: 'commons-cli', name: 'commons-cli', version: '1.0'
    groovy group: 'org.codehaus.groovy', name: 'groovy', version: '1.8.0'
    compile group: 'log4j', name: 'log4j', version: '1.2.9'
    compile group: 'org.codehaus.groovy.modules.http-builder', name: 'http-builder', version: '0.5.2'
    compile group: 'groovy', name: 'groovy-xmlrpc', version: '0.3'
    testCompile group: 'junit', name: 'junit', version: '4.0'
}


run {
    if (project.hasProperty('args')) {
        args project.args.split('\\s+')
    }
}

cobertura {
    coverageSourceDirs = sourceSets.main.java.srcDirs + sourceSets.main.groovy.srcDirs
}

The source of the Main class, where the error seems to reside, is

package mycompany.myproject


class Main {
    static main(args) {
        def env = args ? args[0] : 'prod'
        new Coordinator().run(env)
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T22:59:08+00:00Added an answer on June 7, 2026 at 10:59 pm

    Sounds like the wrong ASM version gets included, although I’m not sure why. Anyway, it’s usually simpler and safer to use groovy-all instead of groovy, and it should also solve this problem.

    You shouldn’t use Groovy 1.8.0 but the latest minor release (1.8.6).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to add groovy-shell-server to our application. We have run into a couple
In a groovy swing application, I have a class that represents teachers like the
I have a groovy/grails application that needs to serve images It works fine on
We have an application in Grails 2.0 that we have working when we run
I have a grails(2.0.3) application that has a jar dependency on another project which
I have a working little application made in Groovy. At the moment I can
I have a Java application that does something like: public class MyApplication { public
The application that I would like to revamp is pretty well organized. UI is
I have a application built on groovy and Grails (grails version 2.0.4). I;m using
I have a Java application that is running embedded groovy scripts using a GroovyClassLoader

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.