Having difficulties with Shadow (ShadowJar)

Hey all, new to the community, please be patient with me, I am sure to break a thousand items of community culture : )

I am an old fart software engineer who got into the field in 1986. I’ve been developing in Java since 1.2. I am more windows savvy, having short bumps at Linux. I have been (to my detriment) able to avoid the whole github/maven/gradle/linux aspect of engineering. Having personally created my own o/s build scripts over the years.

So long story long, i’m trying to rectify that and get into Gradle. I’ve cast aside Eclipse, and am using IntelliJ Idea 2020.2. Im using Gradle 7.0 in IntelliJ (seems the default version, i didn’t make any selections here). I’m using Java 14 (Don’t know how to specify version 14 in source compatibility).

When I double click on Gradle > Shadow > ShadowJar (Im expecting a fat jar here with all the dependancies libbed in)

I get the following error:

A problem was found with the configuration of task ‘:shadowJar’ (type ‘ShadowJar’).
No value has been specified for property ‘mainClassName’.

Here is what I know:

  • I know I should be using a newer version of Shadow
  • I know my source compatibility is wrong (im using java 14)
  • I’ve googled for the problem, found many folks that had it, but didn’t understand the
    solutions, despite trying to understand them in the mysterious Github

What i’m looking for:

  • What versions i should be using,
  • how to fix my syntax
  • anything 101 to increase my gradle knowledge, grounded in this situation

Here is my build.gradle:

plugins {
    id 'java'
    id 'application'
    id 'com.github.johnrengelman.shadow' version '2.0.1'
}

mainClassName = 'com.netpile.sorrowsTale.discord.SorrowsTaleBot'

group 'com.netpile'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8

repositories {
    mavenCentral()
    jcenter()
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.12'
    compile 'net.dv8tion:JDA:3.5.0_329'
}

Thanks in advance for your time and community : )

Galger DM

Okay Update: I was able to fix the issue !

 id 'com.github.johnrengelman.shadow' version '6.0.0'

I updated the plugin and all was fine…