kazurayam / selenium-webdriver-java

Examples of the O'Reilly book "Hands-On Selenium WebDriver with Java"
https://oreil.ly/1E7CX
Apache License 2.0
0 stars 0 forks source link

In IntelliJ IDEA, could not run Gradle for the master branch of the selenium-webdriver-java project #2

Closed kazurayam closed 10 months ago

kazurayam commented 10 months ago

I cloned out the master branch of https://github.com/kazurayam/selenium-webdriver-java. I just opend it in the IntelliJ IDEA. IntelliJ IDEA showed error messages in the Build tab.

スクリーンショット 2023-10-20 17 38 44

The messages in the Build tab was:

A problem occurred configuring project ':selenium-webdriver-junit4'.
> Could not resolve all artifacts for configuration ':selenium-webdriver-junit4:classpath'.
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.1.4.
     Required by:
         project :selenium-webdriver-junit4 > org.springframework.boot:org.springframework.boot.gradle.plugin:3.1.4
      > No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.1.4 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.1' but:
          - Variant 'apiElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.4 declares a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares an API of a component compatible with Java 17 and the consumer needed a runtime of a component compatible with Java 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.1')
          - Variant 'javadocElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.4 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 packaged as a jar)
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.1')
          - Variant 'mavenOptionalApiElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.1.4 declares a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares an API of a component compatible with Java 17 and the consumer needed a runtime of a component compatible with Java 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.1')
          - Variant 'mavenOptionalRuntimeElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.1.4 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 17 and the consumer needed a component compatible with Java 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.1')
          - Variant 'runtimeElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.4 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 17 and the consumer needed a component compatible with Java 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.1')
          - Variant 'sourcesElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.4 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 packaged as a jar)
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.1')

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
kazurayam commented 10 months ago

I checked IntelliJ IDEA > Preferences > Build, Execution, Deployment > Build Tools > Gradle

スクリーンショット 2023-10-20 17 47 27

I found the JVM for Gradle is set to be JDK8. It's too old!

kazurayam commented 10 months ago

I changed the IntelliJ IDEA's config to set the Gradle JVM to be JDK17:

名称未設定

I stoped IDEA and restarted it. I re-opend the selenium-webdriver-java project.

kazurayam commented 10 months ago

In the Build tab, I got the following message

Unsupported Java. 
Your build is currently configured to use Java 17.0.8 and Gradle 7.1.

Possible solution:
 - Use Java 16 as Gradle JVM: Open Gradle settings 
 - Upgrade Gradle wrapper to 7.2 version and re-import the project

The messages changed. The Gradle build worked on JDK17. This issue has been resolved.

Thout it shows other message, but I will follow it in another issue.