TestProject Forum
Powered by leading experts in the test automation community

Java SDK does not getting installed in gradle project

I inserted following code in my gradle project’s buil.gradle file under dependencies.Still it does not support testproject.

compile ‘io.testproject:java-sdk:0.63.2’

Getting an error as follows:

Task :compileJava FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:compileJava’.

Could not resolve all files for configuration ‘:compileClasspath’.
Could not find io.testproject:java-sdk:0.63.2.
Searched in the following locations:
- https://jcenter.bintray.com/io/testproject/java-sdk/0.63.2/java-sdk-0.63.2.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in ‘Maven POM’ format, you need to adjust the ‘metadataSources { … }’ of the repository declaration.
Required by:
project :

  • 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 7.0.
Use ‘–warning-mode all’ to show the individual deprecation warnings.
See https://docs.gradle.org/6.5.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 2s
1 actionable task: 1 executed

Hi @suranga .
I suspect that the example you have used is to add SDK dependency from locally saved file.

You can use the following line and paste it in dependencies into your build.gradle file
compile group: 'io.testproject', name: 'java-sdk', version: '0.63.2-RELEASE'

This should automatically fetch the SDK from repository.

hi,
Thank you for your response.I replaced it.Still getting an error as follows:

> Task :compileJava FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:compileJava’.

Could not resolve all files for configuration ‘:compileClasspath’.
Could not resolve io.testproject:java-sdk:0.63.2-RELEASE.
Required by:
project :
No matching variant of io.testproject:java-sdk:0.63.2-RELEASE was found. The consumer was configured to find an API of a library compatible with Java 8, preferably in the form of class files, and its dependencies declared externally but:
- Variant ‘apiElements’ capability io.testproject:java-sdk:0.63.2-RELEASE declares an API of a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8
- Variant ‘javadocElements’ capability io.testproject:java-sdk:0.63.2-RELEASE declares a runtime of a component, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn’t say anything about its target Java version (required compatibility with Java 8)
- Doesn’t say anything about its elements (required them preferably in the form of class files)
- Variant ‘runtimeElements’ capability io.testproject:java-sdk:0.63.2-RELEASE declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8
- Variant ‘sourcesElements’ capability io.testproject:java-sdk:0.63.2-RELEASE declares a runtime of a component, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn’t say anything about its target Java version (required compatibility with Java 8)
- Doesn’t say anything about its elements (required them preferably in the form of class files)

Thanks for quick reply @suranga .
As i can see, you have selected Java 8 for your Gradle project, which is not compatible with the SDK
The minimun required Java version is 11

thanks.
i tried with java 11.it gives the same error

@suranga what IDE you’re using?

I am using Eclipse IDE.

@suranga i guess you changed the project JDK but not the one that used for Gradle. Can you check that please?

1 Like

i changed the jdk in gradle task settings.Now its working fine.thanks

Always welcome @suranga1201