Duplicate classes in jar prevent desktop client from working

The ‘build’ is creating jars with duplicate classes, so the jarsigner fails to sign them, which prevents the desktop application from working via webstart.

I’ve run ‘gradle clean’, and then the ‘gradle createWebstart’ and still the same errors.

Errors similar to the following:

[signjar] jarsigner: unable to sign jar: java.util.zip.ZipException: duplicate entry: com/company/grocery/gui/extuser/ExtUserBrowser.class
failed to sign jar file app-gui-0.1-SNAPSHOT.jar.sig
: jarsigner returned: 1
        at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:644)

Any ideas?

1 Like

I have some additional information, it appears that when you have ‘groovy’ enabled, the same classes are compiled under both ‘groovy’ and ‘java’, and thus when the jar is created you get duplicate entries.

image

Unchecking the ‘groovy support’ on the ‘advanced properties’ tab allows the jars to be correctly built, and used by webstart.

Now to figure-out why the application appears, then immediately disappears (I assume crashes…).

Hi,

There is a workaround:

configure([globalModule, coreModule, webModule]) {
    apply(plugin: 'groovy')

    sourceSets {
        main { groovy { srcDirs = ["src"] } }
        test { groovy { srcDirs = ["test"] } }
    }

    // Add these lines
    sourceSets.main.java.srcDirs = []
    sourceSets.test.java.srcDirs = []
}

This will disable Java compiler from producing duplicated classes.

1 Like