TestProject Forum
Powered by leading experts in the test automation community

Problem with getting started with the SDK examples

Hello,

I have a problem with running the example from here:

I am new to java programming and to gradle.

I did the following steps:

  1. In IntelliJ IDEA I clicked on File -> Open and then I wrote the path to the web folder(java-sdk-examples\java-sdk-examples\Web).

It loaded the project but there are problems:
this is what it show:

Invalid Gradle JDK configuration found. Open Gradle Settings Project JDK is not specified. Open Project SDK Configuration

Image:

I know that I need to install gradle. I did the following guide:
https://docs.gradle.org/current/userguide/installation.html
using Chocolatey package manager.

I also downloaded the “io.testproject.sdk.java.jar” file and in the build.grade settings, under dependencies section (inside the {} ) I changed the path to the file to the currect path.

This is the configuration of the file:

[code]group ‘io.testproject’
version ‘0.1’

apply plugin: ‘java’

sourceCompatibility = 1.8

repositories {
mavenCentral()
}

// Configurations
configurations {
tpsdk
compile.extendsFrom tpsdk
}

// JAR Task
jar {
archiveName “{rootProject.name}-{version}.jar”
dependsOn configurations.runtime
from {
// Removes TestProject SDK from the final jar file
(configurations.runtime - configurations.tpsdk).collect {
it.isDirectory() ? it : zipTree(it)
}
}
}

dependencies {
// Update the location of the sdk as required
tpsdk files(‘D:\tools\io.testproject.sdk.java.jar’)
testCompile group: ‘junit’, name: ‘junit’, version: ‘4.12’
}[/code]

Thank you.

Hello Goku,

It looks like there is no JDK configuration in your project.
Please make sure that you have [http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html]JDK installed.
After that, go to Gradle settings in you Intellij IDE (File–>Settings–>Build,Execution,Deployment–>Build Tools–>Gradle) and make sure you’ve selected:
[list]
[li]Use default gradle wrapper (recommended)[/li]
[li]Gradle JVM: The installed JDK version (for example: 1.8)[/li]
[/list]