x80486
05/09/2019, 10:47 PMfrom(compileJava) is not working. Any advice?Czar
05/09/2019, 10:57 PMtask<Zip>("distribution") {
dependsOn("jar")
archiveFileName.set("${project.name}.zip")
from(tasks.compileJava)
from(tasks.processResources)
into("lib") {
from(configurations.runtimeClasspath)
}
}x80486
05/09/2019, 11:08 PM* What went wrong:
Script compilation error:
Line 159: from(tasks.compileJava)
^ Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public val TaskContainer.compileJava: TaskProvider<JavaCompile> defined in org.gradle.kotlin.dsl
1 errorCzar
05/09/2019, 11:08 PMx80486
05/09/2019, 11:08 PMfrom(processResources) works fine…x80486
05/09/2019, 11:08 PMCzar
05/09/2019, 11:11 PMCzar
05/09/2019, 11:12 PMCzar
05/09/2019, 11:18 PMfrom does it bring up org.gradle.api.tasks.AbstractCopyTask ?x80486
05/09/2019, 11:18 PMx80486
05/09/2019, 11:19 PMtasks. is because task<Zip>("distribution") itself is inside the tasks block…Czar
05/09/2019, 11:21 PMCzar
05/09/2019, 11:21 PMtasks {
register<Zip>("distribution") {
dependsOn("jar")
archiveFileName.set("${project.name}.zip")
from(compileJava)
from(processResources)
into("lib") {
from(configurations.runtimeClasspath)
}
}
}x80486
05/09/2019, 11:23 PMCzar
05/09/2019, 11:26 PMCzar
05/09/2019, 11:27 PMx80486
05/09/2019, 11:38 PMCzar
05/10/2019, 12:03 AMgildor
05/14/2019, 5:47 AMplugins {} block with applied java plugin. To use them you have to use:
plugins {
java // or kotlin("jvm")
}
If you use plugin.apply it will not workx80486
05/14/2019, 12:12 PMjava plugin in the plugins { } block, as you stated, slightly different (like: id("org.gradle.java")), but it's there...x80486
05/14/2019, 12:28 PMfrom(compileJava) doesn't have any effect; it generates the ZIP file, but with no classes, just the first segment of the package declaration(s) as a folder: com/gildor
05/14/2019, 12:36 PM