Skip to content

Configuration of runShadow task appears to be broken by Gradle 6.4.x #574

@sfitts

Description

@sfitts

Shadow Version

5.2.0

Gradle Version

6.4.1

Expected Behavior

The runShadow task requires that mainClassName be set (currently after the application of the application plug-in and before the application of the shadow plug-in). For example:

apply plugin: 'application'
mainClassName = 'io.vantiq.vertx.launcher.VantiqLauncher'
apply plugin: 'com.github.johnrengelman.shadow'

Normally when applied in this manner the application runs as expected. This has been true for all tested versions of Gradle 5.x and is true for Gradle 6.3 (and we presume all prior 6.x releases, though we have not explicitly tested this).

Actual Behavior

Doing this in Gradle 6.4.1 produces the error:

$ ./gradlew servers:standalone:runShadow
> Task :servers:standalone:runShadow FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':servers:standalone:runShadow'.
> The value for task ':servers:standalone:runShadow' property 'mainClass' is final and cannot be changed any further.

If I had to guess I'd say this was collateral damage for the changes relating to Java Module support. In particular you can see that the definition of the JavaApplication type changed from 6.3 to 6.4.1. Note the removal of mainClassName and the introduction of mainClass.

This seems like an extremely unfriendly thing to do in a "minor" release and it may well have been unintentional. But it appears to have completely broken this task. I can't find a way around this. Setting mainClass in the application block as the Gradle documentation suggests leads to the error:

* What went wrong:
A problem was found with the configuration of task ':servers:standalone:shadowJar' (type 'ShadowJar').
> No value has been specified for property 'mainClassName'.

I have been unable to find something that both sets that value and doesn't violate the fact that it can't be set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions