I seem to be stuck in a catch-22 with the jdk settings for buildship.I’m having the reverse of the problem described here: Change JDK used by Buildship . The project I’m working on is a legacy project, so I can’t upgrade it to jdk 8. If I set the org.gradle.java.home property in gradle.properties (org.gradle.java.home=/opt/java/versions/jdk1.7.0_80) my gradle build tasks will work, but I get an 'Unsupported major.minor version 52.0'
error when I do a ‘refresh gradle project’ in eclipse to update the dependencies. If I take that setting out of the properties file, I can do the dependency refresh, but when I try to run the gradle build task it fails with
'Process 'command '/opt/java/versions/jdk1.8.0_121/bin/java'' finished with non-zero exit value 1'.
I’m pulling my hair out trying to get this to work. What am I doing wrong?
FYI, here are the build.gradle files I’m using:
My Library:
apply plugin: 'java'
apply plugin: 'maven'
group = 'com.bizo'
version = [System.env.TRAVIS_TAG, '1.39'].find { it != null }
sourceCompatibility = '1.7'
targetCompatibility = '1.7'
configurations {
deployerJars
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier 'sources'
from sourceSets.main.allSource
}
artifacts {
archives sourcesJar
}
repositories {
mavenCentral()
maven { url 'http://repo.joist.ws' }
}
dependencies {
compile 'commons-lang:commons-lang:2.6'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.6'
compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.1'
compile 'commons-beanutils:commons-beanutils:1.8.2'
compile 'org.yaml:snakeyaml:1.8'
compile 'joist:joist-util:1.9.1'
compile group: 'ru.vyarus', name: 'generics-resolver', version: '2.0.1'
testCompile 'junit:junit:4.12'
testCompile 'org.hamcrest:hamcrest-junit:2.0.0.0'
deployerJars 'org.apache.maven.wagon:wagon-ssh:2.6'
}
uploadArchives {
repositories.mavenDeployer {
configuration = configurations.deployerJars
repository(url: uploadUrl) {
authentication(userName: username, password: password)
}
snapshotRepository(url: uploadUrl + '/snapshots') {
authentication(userName: username, password: password)
}
}
}
jar{
baseName = 'dtonator'
version = '1.39'
}
My Project:
apply plugin: 'java'
apply plugin: 'maven'
group = 'com.tura'
version = [System.env.TRAVIS_TAG, 'SNAPSHOT'].find { it != null }
sourceCompatibility = '1.7'
targetCompatibility = '1.7'
task sourcesJar(type: Jar, dependsOn: classes) {
classifier 'sources'
from sourceSets.main.allSource
}
artifacts {
archives sourcesJar
}
repositories {
mavenCentral()
maven { url repoUrl }
maven { url 'http://repo.joist.ws' }
}
dependencies {
compile group: 'com.bizo', name: 'dtonator', version: '1.39'
}
task dtonator(type: JavaExec) {
classpath sourceSets.main.compileClasspath
main = 'com.bizo.dtonator.Dtonator'
}
compileJava.dependsOn(dtonator)