TestNG库在使用Gradle时未下载。

huangapple go评论46阅读模式
英文:

TestNG libs not downloaded while using gradle

问题

I am new to gradle and have rarely used maven also before. I have built a Automation Framework using TestNG and adding wrapper around TestNG. Now I want to make it as a gradle project. I am using the below content in the build.gradle.

plugins {
    // Apply the java-library plugin for API and implementation separation.
    id 'java-library'
}

//mainClassName = "mainclass"

repositories {
    // Use Maven Central for resolving dependencies.
    mavenCentral()
}

dependencies {
    implementation group: 'javax.json', name: 'javax.json-api', version: '1.1.4'
    implementation group: 'org.testng', name: 'testng', version: '7.7.1'
}

In this case only javax-json-api.jar is downloaded and added to the 'Projects and External Dependencies' section in Eclipse. TestNG doesn't get downloaded and Eclipse shows me the compilation errors. I tried compile and testImplementation as well, nothing worked.

Note: I am not using TestNG for unit testing here. I am trying to build a Function Test Framework.

英文:

I am new to gradle and have rarely used maven also before. I have built a Automation Framework using TestNG and adding wrapper around TestNG. Now I want to make it as a gradle project. I am using the below content in the build.gradle.

plugins {
    // Apply the java-library plugin for API and implementation separation.
    id 'java-library'
}

//mainClassName = "mainclass"

repositories {
    // Use Maven Central for resolving dependencies.
    mavenCentral()
}

dependencies {
    implementation group: 'javax.json', name: 'javax.json-api', version: '1.1.4'
    implementation group: 'org.testng', name: 'testng', version: '7.7.1'
}

In this case only javax-json-api.jar is downloaded and added to the 'Projects and External Dependencies' section in Eclipse. TestNG doesn't get downloaded and Eclipse shows me the compilation errors. I tried compile and testImplementation as well, nothing worked.

Note: I am not using TestNG for unit testing here. I am trying to build a Function Test Framework.

答案1

得分: 1

我使用的是Java 8,而TestNG 7.7.1 需要Java 11或更高版本。
在我切换到TestNG 7.5之后,一切都正常运行了。

参考链接:
https://stackoverflow.com/questions/73075884/org-testng-itestlistener-has-been-compiled-by-a-more-recent-version-of-the-java
https://testng.org/doc/

英文:

I was using java 8 and testng 7.7.1 requires java 11 or higher.
It worked fine for me after I used testng 7.5.

References:
https://stackoverflow.com/questions/73075884/org-testng-itestlistener-has-been-compiled-by-a-more-recent-version-of-the-java
https://testng.org/doc/

huangapple
  • 本文由 发表于 2023年3月1日 13:34:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/75599920.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定