No value has been specified for property mainClassName
Please check the (User Guide)[http://imperceptiblethoughts.com/shadow] before submitting "how do I do 'x'?" questions!
Shadow Version
2.0.1
Gradle Version
4.3
Expected Behavior
work as in 4.2.1
Actual Behavior
:shadowJar A problem was found with the configuration of task ':shadowJar'. Registering invalid inputs and outputs via TaskInputs and TaskOutputs methods has been deprecated and is scheduled to be removed in Gradle 5.0.
- No value has been specified for property 'mainClassName'.
Build script
Extract of my build script
apply plugin: 'java' apply plugin: 'application' apply plugin: 'com.github.johnrengelman.shadow'
mainClassName = 'com.package.to.Class'
shadowJar { baseName = 'launcher' classifier = null version = null }
same here, just have updated to gradle 4.3, shadow version 2.0.1 (as before)
Fwiw the resulting jar still works (for me) despite the warning, what actually breaks with gradle 4.3 is runShadow.
I'm also seeing this with shadow 2.0.2 and gradle 4.4.
Might just be a missing mainClassName = 'com.package.to.Class' in this plugin's build?
If you define mainClassName before you apply the plugin, the build succeeds. Sounds like an issue with initialization order.
Can confirm, placing the mainClassName after the application plugin and before the shadow plugin lines removes the warnings
I'm also seeing this with shadow 2.0.2 and gradle 4.5.
yeah, i need to improve this, but the workaround is to specify mainClassName before applying the Shadow plugin.
With the build.gradle below, I still get:
A problem was found with the configuration of task ':vertx-web:shadowJar'. Registering invalid inputs and outputs via TaskInputs and TaskOutputs methods has been deprecated and is scheduled to be removed in Gradle 5.0.
- No value has been specified for property 'mainClassName'.
The SimpleWorkResult type has been deprecated and is scheduled to be removed in Gradle 5.0. Please use WorkResults.didWork() instead.
> Task :vertx-web:startShadowScripts
Using TaskInputs.file() with something that doesn't resolve to a File object has been deprecated and is scheduled to be removed in Gradle 5.0. Use TaskInputs.files() instead.
Gradle version: 4.4
plugins {
id 'application'
id 'com.github.johnrengelman.shadow' version '2.0.1'
}
mainClassName = 'io.vertx.core.Launcher'
def vertxVersion = '3.5.0'
def mainVerticleName = 'com.charter.devtool.web.vertx.verticle.MainVerticle'
def watchForChange = 'src/**/*'
def doOnChange = './gradlew classes'
dependencies {
compile project(':devtool-core')
compile project(':devtool-db')
compile project(':devtool-stash-client')
compile('io.vertx:vertx-core:3.5.0')
compile('io.vertx:vertx-web:3.5.0')
compile('com.zandero:rest.vertx:0.7.5')
compile('org.eclipse.jgit:org.eclipse.jgit:4.9.2.201712150930-r')
compile('com.github.salomonbrys.kodein:kodein:4.1.0')
}
shadowJar {
mainClassName = 'io.vertx.core.Launcher'
classifier = 'fat'
manifest {
attributes "Main-Verticle": mainVerticleName
}
mergeServiceFiles {
include 'META-INF/services/io.vertx.core.spi.VerticleFactory'
}
}
run {
args = ['run', mainVerticleName, "--redeploy=$watchForChange", "--launcher-class=$mainClassName", "--on-redeploy=$doOnChange"]
}
Try something like
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.2'
}
}
plugins {
id "application"
}
mainClassName = '...'
apply plugin: 'com.github.johnrengelman.shadow'
[...]
The above workaround fixes the 'mainClassName' issue, but does not address the following warning:
Task :vertx-web:startShadowScripts Using TaskInputs.file() with something that doesn't resolve to a File object has been deprecated and is scheduled to be removed in Gradle 5.0. Use TaskInputs.files() instead.
After a little more digging, seems like this has been fixed but not yet released. Thx @johnrengelman ! Looking forward to 2.0.3.
The application plugin needs this property in gradle build file. It is in docs.
shadow plugin 2.0.3 with gradle 4.6 still have this issue:
buildscript {
repositories {
mavenLocal()
maven { url "http://maven.aliyun.com/nexus/content/groups/public" }
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.3'
}
}
apply plugin: 'codenarc'
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'application'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'idea'
mainClassName='com.zcwl.BarnApplication'
./gradlew shadowjar --warning-mode=all
> Task :shadowJar
A problem was found with the configuration of task ':shadowJar'. Registering invalid inputs and outputs via TaskInputs and TaskOutputs methods has been deprecated and is scheduled to be removed in Gradle 5.0.
- No value has been specified for property 'mainClassName'.
BUILD SUCCESSFUL in 6s
5 actionable tasks: 3 executed, 2 up-to-date
Looks like issue is fixed in Version 2.0.4
I'm still getting the error with version 2.0.4.
The problem is still there for me when using 2.0.4 as well.
Has there been any progress on this @johnrengelman ?
Moving mainClassName before applying the plugin doesn't help for me.
This is still a problem with gradle 4.10 and shadow 2.0.4.