Gradle build for kotlin failing - gradle

I have a kotlin package for which I'm trying to write a gradle setup to automate building. The related repository can be found on github -> https://github.com/ishankhare07/kotlin-web-server/tree/feature/dynamic-routing
Currently running gradle build or gradle compileLKotlin fails with the following error:
e: java.lang.ArrayIndexOutOfBoundsException: 450
at org.jetbrains.org.objectweb.asm.ClassReader.readUnsignedShort(ClassReader.java:2464)
at org.jetbrains.org.objectweb.asm.ClassReader.readUTF8(ClassReader.java:2525)
at org.jetbrains.org.objectweb.asm.ClassReader.readModule(ClassReader.java:761)
at org.jetbrains.org.objectweb.asm.ClassReader.accept(ClassReader.java:646)
at org.jetbrains.org.objectweb.asm.ClassReader.accept(ClassReader.java:507)
at org.jetbrains.kotlin.resolve.jvm.modules.JavaModuleInfo$Companion.read(JavaModuleInfo.kt:67)
at org.jetbrains.kotlin.cli.jvm.modules.CliJavaModuleFinder.findSystemModule(CliJavaModuleFinder.kt:44)
at org.jetbrains.kotlin.cli.jvm.modules.CliJavaModuleFinder.access$findSystemModule(CliJavaModuleFinder.kt:25)
at org.jetbrains.kotlin.cli.jvm.modules.CliJavaModuleFinder$systemModules$1.invoke(CliJavaModuleFinder.kt:37)
at org.jetbrains.kotlin.cli.jvm.modules.CliJavaModuleFinder$systemModules$1.invoke(CliJavaModuleFinder.kt:25)
at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:149)
at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:109)
at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:133)
at kotlin.sequences.FlatteningSequence$iterator$1.ensureItemIterator(Sequences.kt:254)
at kotlin.sequences.FlatteningSequence$iterator$1.hasNext(Sequences.kt:241)
at kotlin.sequences.SequencesKt___SequencesKt.none(_Sequences.kt:1239)
at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.addModularRoots(ClasspathRootsResolver.kt:227)
at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.computeRoots(ClasspathRootsResolver.kt:124)
at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.convertClasspathRoots(ClasspathRootsResolver.kt:79)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:230)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:114)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.createForProduction(KotlinCoreEnvironment.kt:409)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createCoreEnvironment(K2JVMCompiler.kt:286)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createEnvironmentWithScriptingSupport(K2JVMCompiler.kt:276)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:155)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:63)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:109)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:53)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:92)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:451)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:97)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:218)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.access$compileIncrementally(IncrementalCompilerRunner.kt:37)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner$compile$2.invoke(IncrementalCompilerRunner.kt:80)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:92)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.execIncrementalCompiler(CompileServiceImpl.kt:518)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.access$execIncrementalCompiler(CompileServiceImpl.kt:97)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:400)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:97)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:895)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:97)
at org.jetbrains.kotlin.daemon.common.DummyProfiler.withMeasure(PerfUtils.kt:137)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.checkedCompile(CompileServiceImpl.kt:925)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.doCompile(CompileServiceImpl.kt:894)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:399)
at jdk.internal.reflect.GeneratedMethodAccessor23.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:844)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileKotlin'.
> Internal compiler error. See log for more details
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
Below is my build.gradle file:
buildscript {
ext.kotlin_version = '1.2.21'
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
plugins {
id "org.jetbrains.kotlin.jvm" version "1.2.21"
id "com.jfrog.bintray" version "1.7.3"
id 'maven-publish'
}
repositories {
jcenter()
mavenCentral()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib"
}
jar {
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}
task sourcesJar(type: Jar, dependsOn: project.classes) {
from sourceSets.main.allSource
}
publishing {
publications {
publishToBintray(MavenPublication) {
artifact sourcesJar
groupId 'com.ishankhare.kotlin-server'
}
}
}
bintray {
user = 'ishankhare07'
key = '9b693a0c46f7021021a2422f3ea837f0ad8e3ea6'
publications = ['publishToBintray']
pkg {
version {
name = 'v0.0.1'
}
repo = 'server'
name = 'server'
licenses = ['MIT']
vcsUrl = 'https://github.com/ishankhare07/kotlin-web-server'
}
}
sourceSets {
main.kotlin.srcDirs += "./"
}
On running the build with --info flag I get the following output:
Initialized native services in: /Users/ishankhare/.gradle/native
The client will now receive all logging from the daemon (pid: 11054). The daemon log file: /Users/ishankhare/.gradle/daemon/4.10/daemon-11054.out.log
Starting 42nd build in daemon [uptime: 43 mins 31.646 secs, performance: 100%, no major garbage collections]
Using 4 worker leases.
Starting Build
Settings evaluated using settings file '/Users/ishankhare/code/ishan/kotlin-web-server/server/settings.gradle'.
Projects loaded. Root project using build file '/Users/ishankhare/code/ishan/kotlin-web-server/server/build.gradle'.
Included projects: [root project 'server']
> Configure project :
Evaluating root project 'server' using build file '/Users/ishankhare/code/ishan/kotlin-web-server/server/build.gradle'.
All projects evaluated.
Selected primary task 'compileKotlin' from project :
Tasks to be executed: [task ':compileKotlin']
:compileKotlin (Thread[Task worker for ':',5,main]) started.
e: java.lang.ArrayIndexOutOfBoundsException
> Task :compileKotlin FAILED
file or directory '/Users/ishankhare/code/ishan/kotlin-web-server/server/src/main/kotlin', not found
file or directory '/Users/ishankhare/code/ishan/kotlin-web-server/server/src/main/java', not found
Task ':compileKotlin' is not up-to-date because:
Task has failed previously.
All input files are considered out-of-date for incremental task ':compileKotlin'.
file or directory '/Users/ishankhare/code/ishan/kotlin-web-server/server/src/main/kotlin', not found
file or directory '/Users/ishankhare/code/ishan/kotlin-web-server/server/src/main/java', not found
file or directory '/Users/ishankhare/code/ishan/kotlin-web-server/server/src/main/kotlin', not found
file or directory '/Users/ishankhare/code/ishan/kotlin-web-server/server/src/main/java', not found
Using Kotlin incremental compilation
Options for KOTLIN DAEMON: IncrementalCompilationOptions(super=CompilationOptions(compilerMode=INCREMENTAL_COMPILER, targetPlatform=JVM, reportCategories=[0], reportSeverity=2, requestedCompilationResults=[0]), areFileChangesKnown=false, modifiedFiles=null, deletedFiles=null, workingDir=/Users/ishankhare/code/ishan/kotlin-web-server/server/build/kotlin/compileKotlin, customCacheVersionFileName='gradle-format-version.txt', customCacheVersion=4, resultDifferenceFile=/Users/ishankhare/code/ishan/kotlin-web-server/server/build/kotlin/compileKotlin/build-history.bin, friendDifferenceFile=null, usePreciseJavaTracking=false)
[KOTLIN] deleting /Users/ishankhare/code/ishan/kotlin-web-server/server/build/classes/kotlin/main on error
[KOTLIN] deleting /Users/ishankhare/code/ishan/kotlin-web-server/server/build/classes/kotlin/main on error
:compileKotlin (Thread[Task worker for ':',5,main]) completed. Took 0.087 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileKotlin'.
> Internal compiler error. See log for more details
* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 0s
1 actionable task: 1 executed

with arrayindexoutofboundsexception at: it basically seems like its looking for stuff and not finding it therefore it is failing my suggestion would be to update and switch the buildscript ext.kotlin_version = '1.2.21' to 1.2.61 this will most likely solve the issues for the stuff that its looking for and not finding

Related

How can I debug Gradle Worker Daemons in IntelliJ?

I am using Gradle Worker Daemons in a custom task to enable parallel work.
The Worker API can accommodate this using the processIsolation() method that causes the work to execute in a separate "worker daemon". These worker daemon processes will persist across builds and can be reused during subsequent builds. If system resources get low, however, Gradle will stop any unused worker daemons.
Note that this not the same as the Gradle Daemon.
I am using Gradle 7.5.1 and IntelliJ IDEA 2022.3.2 (Ultimate Edition).
Basic example - GenerateMD5 WorkAction
I have recreated the basic example in the Worker Daemon docs that will generate MD5 files, based on the example in the Gradle docs.
The exception is that I am using an external library, Apache Commons Codec, to generate the MD5.
// build.gradle.kts
import org.apache.commons.codec.digest.DigestUtils
buildscript {
repositories {
gradlePluginPortal()
mavenCentral()
}
dependencies {
classpath("commons-codec:commons-codec:1.15")
}
}
plugins {
`java-library`
}
repositories {
gradlePluginPortal()
mavenCentral()
}
abstract class GenerateMD5 : WorkAction<GenerateMD5.Parameters> {
interface Parameters : WorkParameters {
val sourceFile: RegularFileProperty
val md5File: RegularFileProperty
}
override fun execute() {
val sourceFile = parameters.sourceFile.asFile.get()
val md5File = parameters.md5File.asFile.get()
val md5Hex = DigestUtils.md5Hex(sourceFile.inputStream())
println("Generated MD5 for ${sourceFile.name}: $md5Hex")
md5File.writeText(md5Hex)
}
}
dependencies {
implementation("commons-codec:commons-codec:1.15")
}
abstract class CreateMD5 : DefaultTask() {
#get:InputFiles
abstract val source: ConfigurableFileCollection
#get:Classpath
abstract val codecClasspath: ConfigurableFileCollection
#get:OutputDirectory
abstract val destinationDirectory: DirectoryProperty
#get:Inject
protected abstract val workerExecutor: WorkerExecutor
#TaskAction
fun createHashes() {
val workQueue: WorkQueue = workerExecutor.processIsolation {
classpath.from(codecClasspath)
forkOptions {
maxHeapSize = "64m"
//debug = true
}
}
source.files.forEach { file ->
workQueue.submit(GenerateMD5::class) {
sourceFile.set(file)
md5File.set(destinationDirectory.file("${file.name}.md5"))
}
}
}
}
val createMd5 by tasks.registering(CreateMD5::class) {
group = "md5"
codecClasspath.from(configurations.runtimeClasspath)
destinationDirectory.set(temporaryDir)
source.from(
resources.text.fromString(
"""
blah
blah
some
file
""".trimIndent()
)
)
}
Running without debug
When I run ./gradlew createMd5, the task executes successfully.
Executing 'createMd5'...
> Task :createMd5
Generated MD5 for string12197505505076104021.txt: 7a55d3ab41f37979cd7cccc92b7fc8fa
BUILD SUCCESSFUL in 866ms
1 actionable task: 1 executed
Execution finished 'createMd5'.
Running with debug
I then try and enable debug mode:
#TaskAction
fun createHashes() {
val workQueue: WorkQueue = workerExecutor.processIsolation {
classpath.from(codecClasspath)
forkOptions {
maxHeapSize = "64m"
debug = true // enable debug
}
}
// ...
I put a breakpoint in DigestUtils.java
And I then run the task with the debug options enabled in Intellij
However, I get an error.
Executing 'createMd5'...
Starting Gradle Daemon...
Connected to the target VM, address: '127.0.0.1:59032', transport: 'socket'
Gradle Daemon started in 1 s 460 ms
ERROR: transport error 202: bind failed: Address already in use
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [./src/jdk.jdwp.agent/share/native/libjdwp/debugInit.c:735]
Could not write standard input to Gradle Worker Daemon 1.
java.io.IOException: Broken pipe
at java.base/java.io.FileOutputStream.writeBytes(Native Method)
at java.base/java.io.FileOutputStream.write(FileOutputStream.java:354)
at java.base/java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:81)
at java.base/java.io.BufferedOutputStream.flush(BufferedOutputStream.java:142)
at org.gradle.process.internal.streams.ExecOutputHandleRunner.forwardContent(ExecOutputHandleRunner.java:68)
at org.gradle.process.internal.streams.ExecOutputHandleRunner.run(ExecOutputHandleRunner.java:53)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
> Task :createMd5 FAILED
1 actionable task: 1 executed
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':createMd5'.
> A failure occurred while executing Build_gradle$GenerateMD5
> Failed to run Gradle Worker Daemon
> Process 'Gradle Worker Daemon 1' finished with non-zero exit value 2
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 6s
Disconnected from the target VM, address: '127.0.0.1:59032', transport: 'socket'
Execution finished 'createMd5'.
Attempts
I have tried killing the Gradle Daemon,
./gradlew --stop
but to no effect.
I have also tried killing the Gradle Daemon
pkill -f '.*GradleDaemon.*';
but this also did not work.
Please try attaching a remote debugger to the running gradlew command.
https://docs.gradle.org/current/userguide/troubleshooting.html#sec:troubleshooting_build_logic

Gradle Error when using maven publishing task

I am using Gradle version 6.7.1, Currently, in my application I facing an issue with the maven publishing task.
We have kept the publishing task in the central location Gradle file named ( nexusgradle-1.0.5.gradle) and importing it via apply from
the content of the central location Gradle (nexusgradle-1.0.5.gradle) is the below which contain the information of nexus repo for snapshot and release along with user credentials for pushing artefacts to nexus.
apply plugin: 'maven-publish'
publishing {
publications {
mavenJava(MavenPublication) {
from components.web
}
}
repositories {
maven {
credentials {
username 'uploader'
password 'uploaderpassword'
}
println 'A message which is logged at QUIET level'
name 'Nexus_Repo'
def releasesRepoUrl = 'http://<hostname>/repository/<maven-releases>/'
def snapshotsRepoUrl = 'http://<hostname>/repository/<maven-snapshots>/'
url = project.version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
}
}
}
The application Gradle ( child Gradle file) looks like the one below
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id 'war'
// Add git release plugin for versioning snaphots and release builds
id 'pl.allegro.tech.build.axion-release' version '1.10.1'
id 'org.springframework.boot' version '2.1.4.RELEASE'
// Add Git properties plugin.
id 'com.gorylenko.gradle-git-properties' version '2.2.0'
id 'jacoco'
}
// apply from center location
apply from :'http://<hostaname>/repository/thirdparty/com/mf/nexusgradle/1.0.5/nexusgradle-1.0.5.gradle'
repositories {
maven {
url = 'http://<hostname>/repository/groupRepo/'
}
jcenter()
}
test {
testLogging.showStandardStreams = true
maxParallelForks = 3
ignoreFailures = true // to skip test Failures
testLogging { //logging the test
exceptionFormat = 'full'
events "passed", "skipped", "failed"
}
}
jacoco {
toolVersion = '0.8.3'
}
jacocoTestReport {
dependsOn test // tests are required to run before generating the report
reports {
xml.enabled true //enabling for generate xml for to capture data in sonarqube server
}
}
// Customize Git properties plugin.
gitProperties {
// Change date format in git.properties file.
dateFormat = "yyyy-MM-dd HH:mm:ssZ"
dateFormatTimeZone = 'GMT'
}
dependencies {
implementation 'org.springframework.boot:spring-boot:2.1.4.RELEASE'
// mutliple import below
}
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
scmVersion {
repository {
directory = project.rootProject.file('.')
}
}
group = 'com.package'
description = 'appname'
project.version = scmVersion.version
project.ext.timestamp = new Date().format("dd/MM/yyyy HH:mm:ss")
processResources {
filter ReplaceTokens, tokens:[BUILD_VERSION: project.version, BUILD_TIMESTAMP: project.ext.timestamp]
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
war {
enabled = true
}
springBoot {
buildInfo()
}
bootWar {
archiveClassifier = 'boot'
mainClassName = 'com.package.appname.SpringBootRunner'
}
when I run the Gradle command for publishing
gradlew clean build publish
The task will fail as the publishing task will try to push artefacts of the snapshot to the release repo instead of the snapshot repo.
> Configure project :
A message which is logged at QUIET level
> Task :clean UP-TO-DATE
> Task :bootBuildInfo
> Task :compileJava
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
> Task :generateGitProperties
> Task :processResources
> Task :classes
> Task :bootWar
> Task :war
> Task :assemble
> Task :check
> Task :build
> Task :generateMetadataFileForMavenJavaPublication
> Task :generatePomFileForMavenJavaPublication
> Task :publishMavenJavaPublicationToNexus_RepoRepository FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':publishMavenJavaPublicationToNexus_RepoRepository'.
> Failed to publish publication 'mavenJava' to repository 'Nexus_Repo'
> Could not PUT 'http://<hostname>/repository/maven-releases/com/package/appname/1.0.9-SNAPSHOT/maven-metadata.xml'. Received status code 400 from server: Repository version policy: RELEASE does not allow metadata in path: com/package/appname/1.0.9-SNAPSHOT/maven-metadata.xml
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
But if I remove the apply from: item and bring the Publishing task to the application Gradle ( child Gradle file) file it will work fine, the build artefact is pushed to snapshot repo without any issue.
> Configure project :
A message which is logged at the QUIET level
> Task :clean UP-TO-DATE
> Task :bootBuildInfo
> Task :compileJava
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
> Task :generateGitProperties
> Task :processResources
> Task :classes
> Task :bootWar
> Task :war
> Task :assemble
> Task :check
> Task :build
> Task :generateMetadataFileForMavenJavaPublication
> Task :generatePomFileForMavenJavaPublication
> Task :publishMavenJavaPublicationToNexus_RepoRepository
> Task :publish
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 29s
10 actionable tasks: 9 executed, 1 up-to-date
Can someone guide me, what mistake I am making when putting the maven publishing task in a parent Gradle file? why child Gradle cant resolve values from parent properly
I found a way to fix it by updating the content of the central Gradle /parent file (nexusgradle-1.0.5.gradle) by adding
afterEvaluate
with the modification, it worked fine.
Is it the correct approach? or is there any better way to do it?
apply plugin: 'maven-publish'
afterEvaluate {project ->
publishing {
publications {
mavenJava(MavenPublication) {
from components.web
}
}
repositories {
maven {
credentials {
username 'uploader'
password 'uploaderpassword!'
}
name 'Nexus_Repo'
def releasesRepoUrl = 'http://<hostname>/repository/<maven-releases>/'
def snapshotsRepoUrl = 'http://<hostname>/repository/<maven-snapshots>/'
url = project.version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
}
}
}
}

How can I add local resources using Gradle Kotlin-DSL

I'm trying to test gradle 5 using kotlin DSL.
I created a lib, and built it as below:
Hasans-Air:blogiclib h_ajsf$ gradle init --type=kotlin-library
Starting a Gradle Daemon, 1 busy Daemon could not be reused, use --status for details
Select build script DSL:
1: groovy
2: kotlin
Enter selection (default: kotlin) [1..2] 2
Project name (default: blogiclib): 
Source package (default: blogiclib): 
**BUILD SUCCESSFUL** in 16s
2 actionable tasks: 2 executed
Hasans-Air:blogiclib h_ajsf$ ls
build.gradle.kts gradlew settings.gradle.kts
gradle gradlew.bat src
Hasans-Air:blogiclib h_ajsf$ code .
Hasans-Air:blogiclib h_ajsf$ gradle build
Then I got the output file generated as: build\libs\blogiclib.jar
The Library.kt file generated is:
package blogiclib
class Library {
fun someLibraryMethod(): Boolean {
return true
}
}
And the build.gradle.kts generated is:
plugins {
id("org.jetbrains.kotlin.jvm").version("1.3.10")
}
repositories {
jcenter()
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
testImplementation("org.jetbrains.kotlin:kotlin-test")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
}
Then I generated a kotlin app and tested it as below:
Hasans-Air:gradle h_ajsf$ gradle init --type=kotlin-application
Starting a Gradle Daemon (subsequent builds will be faster)
Select build script DSL:
1: groovy
2: kotlin
Enter selection (default: kotlin) [1..2] 2
Project name (default: gradle): blogic
Source package (default: blogic): 
**BUILD SUCCESSFUL** in 25s
2 actionable tasks: 2 executed
Hasans-Air:gradle h_ajsf$ ls
build.gradle.kts gradlew settings.gradle.kts
gradle gradlew.bat src
Hasans-Air:gradle h_ajsf$ code .
Hasans-Air:gradle h_ajsf$ gradle run
**BUILD SUCCESSFUL** in 6m 4s
3 actionable tasks: 3 executed
Hasans-Air:gradle h_ajsf$ gradle run
**> Task :run**
Hello world.
Then I added the previously generated lib blogiclib.jar to the folder: main\resources
And made my App.kt file as:
package blogic
import blogiclib.LibraryKt
class App {
val greeting: String
get() {
return "Hello world."
}
}
fun main(args: Array<String>) {
println("${App().greeting} = someLibraryMethod()")
}
And its build.gradle.kts based on my understanding from here as:
plugins {
id("org.jetbrains.kotlin.jvm").version("1.3.10")
application
}
repositories {
jcenter()
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
testImplementation("org.jetbrains.kotlin:kotlin-test")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
}
application {
mainClassName = "blogic.AppKt"
}
task<JavaCompile>("compile") {
source = fileTree(file("src/main/resources/blogiclib.jar"))
}
But at compiling I got the below error:
Hasans-Air:gradle h_ajsf$ gradle run
e: /Users/h_ajsf/Documents/gradle/src/main/kotlin/blogic/App.kt: (6, 8): Unresolved reference: blogiclib
**> Task :compileKotlin** FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileKotlin'.
> Compilation error. See log for more details
* Try:
Run with **--stacktrace** option to get the stack trace. Run with **--info** or **--debug** option to get more log output. Run with **--scan** to get full insights.
* Get more help at **https://help.gradle.org**
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.0/userguide/command_line_interface.html#sec:command_line_warnings
**BUILD FAILED** in 1s
2 actionable tasks: 2 executed
UPDATE
In reference to the comments received, I did the below:
Moved the library file to folder src/main/libs:
Added the below code to the build.gradle.kts:
configurations {
create("externalLibs")
}
dependencies {
"externalLibs"(files("src/main/libs/blogiclib.jar"))
}
instead of:
task<JavaCompile>("compile") {
source = fileTree(file("src/main/resources/blogiclib.jar"))
}
but still getting the same error :(
You can include all jar files in some folders as follows:
dependencies {
implementation(fileTree("libs/compile"))
compileOnly(fileTree("libs/provided"))
}
Alternatively, select specific files:
repositories {
flatDir {
dirs("libs/compile")
dirs("libs/provided")
}
}
dependencies {
implementation(":gson-2.8.5")
compileOnly(":javaee-api-8.0")
}

Trouble getting started with SpringBoot and Gradle

I am a new to Java, Gradle and Spring.
I setup a new project with the following gradle script:
buildscript {
repositories {
maven { url "http://repo.spring.io/snapshot" }
maven { url "http://repo.spring.io/milestone" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.0.BUILD-SNAPSHOT")
}
}
apply plugin: 'java'
apply plugin: 'spring-boot'
repositories {
maven { url "http://repo.spring.io/snapshot" }
maven { url "http://repo.spring.io/milestone" }
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
testCompile("org.springframework.boot:spring-boot-starter-test")
}
When trying to build with the above script, I get the following errors:
E:\Projects\SpringAppTutorial>gradlew
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'SpringAppTutorial'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not resolve org.springframework.boot:spring-boot-gradle-plugin:1.3.0.BUILD-SNAPSHOT.
Required by:
:SpringAppTutorial:unspecified
> Could not resolve org.springframework.boot:spring-boot-gradle-plugin:1.3.0.BUILD-SNAPSHOT.
> Could not parse POM http://repo.spring.io/snapshot/org/springframework/boot/spring-boot-gradle-plugin/1.3.0.BUILD-SNAPSHOT/spring-boot-gradle-plugin-1.3.0.BUILD-20150531.081700-179.pom
> Could not resolve org.springframework.boot:spring-boot-tools:1.3.0.BUILD-SNAPSHOT.
> Could not resolve org.springframework.boot:spring-boot-tools:1.3.0.BUILD-SNAPSHOT.
> Could not parse POM http://repo.spring.io/snapshot/org/springframework/boot/spring-boot-tools/1.3.0.BUILD-SNAPSHOT/spring-boot-tools-1.3.0.BUILD-20150531.081700-180.pom
> Could not resolve org.springframework.boot:spring-boot-parent:1.3.0.BUILD-SNAPSHOT.
> Could not resolve org.springframework.boot:spring-boot-parent:1.3.0.BUILD-SNAPSHOT.
> Could not parse POM http://repo.spring.io/snapshot/org/springframework/boot/spring-boot-parent/1.3.0.BUILD-SNAPSHOT/spring-boot-parent-1.3.0.BUILD-20150531.081700-180.pom
> Could not resolve org.springframework.boot:spring-boot-dependencies:1.3.0.BUILD-SNAPSHOT.
> Could not resolve org.springframework.boot:spring-boot-dependencies:1.3.0.BUILD-SNAPSHOT.
> Could not parse POM http://repo.spring.io/snapshot/org/springframework/boot/spring-boot-dependencies/1.3.0.BUILD-SNAPSHOT/spring-boot-dependencies-1.3.0.BUILD-20150531.081700-181.pom
> Could not find org.springframework.data:spring-data-releasetrain:Fowler-RELEASE.
Searched in the following locations:
http://repo.spring.io/snapshot/org/springframework/data/spring-data-releasetrain/Fowler-RELEASE/spring-data-releasetrain-Fowler-RELEASE.pom
http://repo.spring.io/snapshot/org/springframework/data/spring-data-releasetrain/Fowler-RELEASE/spring-data-releasetrain-Fowler-RELEASE.jar
http://repo.spring.io/milestone/org/springframework/data/spring-data-releasetrain/Fowler-RELEASE/spring-data-releasetrain-Fowler-RELEASE.pom
http://repo.spring.io/milestone/org/springframework/data/spring-data-releasetrain/Fowler-RELEASE/spring-data-releasetrain-Fowler-RELEASE.jar
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 15.726 secs
E:\Projects\SpringAppTutorial>
What am I doing wrong here?
You should be using a release version of the spring-boot gradle plugin - your script is using a development snapshot version string of some kind.
i.e. try
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.3.RELEASE")
}
(from http://docs.spring.io/spring-boot/docs/current/reference/html/build-tool-plugins-gradle-plugin.html)
Assuming that works, you should be able to get rid of this section also:
repositories {
maven { url "http://repo.spring.io/snapshot" }
maven { url "http://repo.spring.io/milestone" }
}
I have faced the same problem and as #skaffman suggests, I added version to my dependencies, it resolved.
implementation('org.springframework.session:spring-session:1.3.4.RELEASE')
runtimeOnly('com.okta.spring:okta-spring-boot-starter:0.6.1')
runtimeOnly('org.springframework.security.oauth:spring-security-oauth2:2.3.4.RELEASE')

Gradle script not able to resolve artifactory

I am using Gradle to access the Artifactory. Artifactory has the particular dependencies but somehow gradle is not able to send any request to Artifactory. Even I tried to clean the cache and run the gradle build command to fetch the file. But I didn't get any success. By gradle.build file is as following.
buildscript {
repositories {
maven { url 'http://repo.jfrog.org/artifactory/gradle-plugins' }
}
dependencies {
classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '2.0.12')
}
}
apply plugin: 'maven'
apply plugin: 'artifactory'
apply plugin: 'java'
repositories {
maven {
url 'http://artifactory/repo'
}
}
group = 'com.locationlabs'
version = '1.1'
artifacts {
archives file("${project.name}-${project.version}-jstest.txt")
}
artifactory {
contextUrl = 'http://artifactory'
publish {
repository {
repoKey = 'autotest'
username = 'rakesh.kumar'
password = 'password'
}
defaults {
publishBuildInfo = true
publishArtifacts = true
publishPom = true
publishIvy = false
}
}
}
artifactoryPublish {
publishConfigs('archives')
}
dependencies {
compile group: 'com.locationlabs', name: 'gradletest', version: '1.0', classifier: 'jstest', ext: 'txt'
}
Whenever I run the gradle script it fails with the following exception and stacktrace.
akesh.kumar#rakesh:~/automation/gradletest$ gradle build --stacktrace
:compileJava
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all dependencies for configuration ':compile'.
> java.lang.NullPointerException (no error message)
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':compile'.
at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver.wrapException(ErrorHandlingArtifactDependencyResolver.java:47)
at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver.access$000(ErrorHandlingArtifactDependencyResolver.java:26)
at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver$BrokenResolvedConfiguration.rethrowFailure(ErrorHandlingArtifactDependencyResolver.java:127)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getFiles(DefaultConfiguration.java:458)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getFiles(DefaultConfiguration.java:203)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.getFiles(Unknown Source)
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext$FileTreeConverter.convertInto(DefaultFileCollectionResolveContext.java:191)
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.doResolve(DefaultFileCollectionResolveContext.java:103)
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.resolveAsFileTrees(DefaultFileCollectionResolveContext.java:75)
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext$FileTreeConverter.convertInto(DefaultFileCollectionResolveContext.java:182)
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.doResolve(DefaultFileCollectionResolveContext.java:98)
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.resolveAsFileTrees(DefaultFileCollectionResolveContext.java:75)
at org.gradle.api.internal.file.CompositeFileCollection$1.resolve(CompositeFileCollection.java:88)
at org.gradle.api.internal.file.CompositeFileCollection.getSourceCollections(CompositeFileCollection.java:143)
at org.gradle.api.internal.file.CompositeFileTree.getSourceCollections(CompositeFileTree.java:30)
at org.gradle.api.internal.file.CompositeFileCollection.getFiles(CompositeFileCollection.java:38)
at org.gradle.api.internal.file.AbstractFileCollection.iterator(AbstractFileCollection.java:60)
at org.gradle.api.internal.changedetection.DefaultFileSnapshotter.snapshot(DefaultFileSnapshotter.java:42)
at org.gradle.api.internal.changedetection.InputFilesChangedUpToDateRule.create(InputFilesChangedUpToDateRule.java:35)
at org.gradle.api.internal.changedetection.CompositeUpToDateRule.create(CompositeUpToDateRule.java:35)
at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateRepository$HistoricExecution.calcCurrentState(DefaultTaskArtifactStateRepository.java:80)
at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateRepository$HistoricExecution.isUpToDate(DefaultTaskArtifactStateRepository.java:88)
at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateRepository$TaskArtifactStateImpl.isUpToDate(DefaultTaskArtifactStateRepository.java:128)
at org.gradle.api.internal.changedetection.ShortCircuitTaskArtifactStateRepository$ShortCircuitArtifactState.isUpToDate(ShortCircuitTaskArtifactStateRepository.java:77)
at org.gradle.api.internal.changedetection.FileCacheBroadcastTaskArtifactStateRepository$1.isUpToDate(FileCacheBroadcastTaskArtifactStateRepository.java:37)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:44)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42)
at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:247)
at org.gradle.execution.DefaultTaskGraphExecuter.executeTask(DefaultTaskGraphExecuter.java:192)
at org.gradle.execution.DefaultTaskGraphExecuter.doExecute(DefaultTaskGraphExecuter.java:177)
at org.gradle.execution.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:83)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:36)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter$1.run(TaskCacheLockHandlingBuildExecuter.java:31)
at org.gradle.cache.internal.DefaultCacheAccess$1.create(DefaultCacheAccess.java:111)
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:126)
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:109)
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:103)
at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:79)
at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter.execute(TaskCacheLockHandlingBuildExecuter.java:29)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:155)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:110)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:78)
at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:42)
at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:28)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:31)
at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:20)
at org.gradle.launcher.Main.doAction(Main.java:48)
at org.gradle.launcher.exec.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.Main.main(Main.java:39)
at org.gradle.launcher.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
at org.gradle.launcher.ProcessBootstrap.run(ProcessBootstrap.java:32)
at org.gradle.launcher.GradleMain.main(GradleMain.java:24)
Caused by: java.lang.NullPointerException
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder$ConfigurationNode.getArtifacts(DependencyGraphBuilder.java:651)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder$DependencyEdge.attachToParents(DependencyGraphBuilder.java:356)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder$ConfigurationNode.attachToParents(DependencyGraphBuilder.java:764)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder.assembleResult(DependencyGraphBuilder.java:140)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder.resolve(DependencyGraphBuilder.java:56)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultDependencyResolver.resolve(DefaultDependencyResolver.java:67)
at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver$1.create(CacheLockingArtifactDependencyResolver.java:36)
at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver$1.create(CacheLockingArtifactDependencyResolver.java:34)
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:126)
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:99)
at org.gradle.api.internal.artifacts.ivyservice.DefaultCacheLockingManager.useCache(DefaultCacheLockingManager.java:49)
at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver.resolve(CacheLockingArtifactDependencyResolver.java:34)
at org.gradle.api.internal.artifacts.ivyservice.SelfResolvingDependencyResolver.resolve(SelfResolvingDependencyResolver.java:42)
at org.gradle.api.internal.artifacts.ivyservice.ShortcircuitEmptyConfigsArtifactDependencyResolver.resolve(ShortcircuitEmptyConfigsArtifactDependencyResolver.java:78)
at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver.resolve(ErrorHandlingArtifactDependencyResolver.java:36)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getResolvedConfiguration(DefaultConfiguration.java:236)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.getResolvedConfiguration(Unknown Source)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getFiles(DefaultConfiguration.java:456)
... 65 more
BUILD FAILED
One very strange thing is that the same script file works on the other machine but doesn't work on mine even though the other machine has the same configuration and setup.
I tried to search on internet but couldn't get any help.
Any kind of help is greatly appreciated here.
I have seen the very same NPE yesterday after I tried to change my project name inside gradle.settings (rootProject.name = 'something'). When I delete this line from gradle.settings, the exception disappears.
After some investigation and with the help of http://forums.gradle.org/gradle/topics/how_to_get_the_latest_integration_version_number I finally found out that the reason is a sort of circular dependency, when my project depended on some module that transitively depends back on a module with the same group and project names as the "current" project.
Might this be your case? What is the name of your project? And what are the dependencies of gradletest? Please check whether your referenced gradletest module does not depend on your project. Or, if your project itself is named gradletest, that would definitely explain the error.

Resources