I have jdk-8 in my local, and I using gradle to build my project. I try to update my hsqldb from version 2.5.2 to 2.7.1. After I update my gradle script:
runtime "org.hsqldb:hsqldb:2.5.2"
to
runtime "org.hsqldb:hsqldb:2.7.1"
Then I build with gradle but it download the java-11 version. Which led an UnsupportedClassVersionError in my project. I found there is a java-8 version in the maven central repository https://repo1.maven.org/maven2/org/hsqldb/hsqldb/2.7.1/.But it will not be downloaded automatically.
I wish can update hsqldb to the latest version, then run gradle build and it can download the correct version. And I can run my project sucessfully.
CodePudding user response:
You need to provide the classifier, which is jdk8 in this case. In your pom.xml:
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.7.1</version>
<classifier>jdk8</classifier>
</dependency>
I know you asked for Gradle but it is the same principle.
CodePudding user response:
you can add classifier to your implementation like this
runtime "org.hsqldb:hsqldb:2.7.1:jdk8"
And you can make sure its added with gradle dependencies
it will show you
runtimeClasspath - Runtime classpath of source set 'main'.
\--- org.hsqldb:hsqldb:2.7.1
testRuntimeClasspath - Runtime classpath of source set 'test'.
\--- org.hsqldb:hsqldb:2.7.1