3

I'm have a Gluon mobile project with a build.gradle like this:

buildscript {
    repositories {
        jcenter()
        google()
        mavenCentral()
        maven {
            url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
        }
    }
    dependencies {
        classpath 'org.javafxports:jfxmobile-plugin:2.0.30'
        classpath 'com.google.gradle:osdetector-gradle-plugin:1.6.0'
        classpath 'com.github.jengelman.gradle.plugins:shadow:4.0.2'
    }
}

repositories {
    jcenter()
    maven {
        url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
    }
}

apply plugin: 'application'
apply plugin: 'org.javafxports.jfxmobile'
apply plugin: 'com.google.osdetector'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'eclipse'

compileJava {
    doFirst {
        options.compilerArgs = [
                '--module-path', classpath.asPath,
                '--add-modules', 'javafx.controls'
        ]
    }
}

run {
    doFirst {
        jvmArgs = [
                '--module-path', classpath.asPath,
                '--add-modules', 'javafx.controls'
        ]
    }
}

sourceCompatibility = 13
targetCompatibility = 13

ext.platform = osdetector.os == 'osx' ? 'mac' : osdetector.os == 'windows' ? 'win' : osdetector.os

dependencies {
    compile "org.openjfx:javafx-base:13:$platform"
    compile "org.openjfx:javafx-graphics:13:$platform"
    compile "org.openjfx:javafx-controls:13:$platform"
    compile "org.openjfx:javafx-fxml:13:$platform"

    compile "org.openjfx:javafx-graphics:13:win"
    compile "org.openjfx:javafx-graphics:13:mac"
    compile "org.openjfx:javafx-graphics:13:linux"

    compile 'com.gluonhq:charm:5.0.0-jdk9'
    compile 'org.reactfx:reactfx:2.0-M5'
    compileOnly 'org.projectlombok:lombok:1.18.6'

    compile project(':GameClientLogic')
}

jfxmobile {
    downConfig {
        version = '3.8.6'
        plugins 'display', 'lifecycle', 'statusbar', 'storage'
    }
    android {
        compileSdkVersion = 23
        minSdkVersion = 23
//      manifest = 'src/android/AndroidManifest.xml'
        packagingOptions {
            pickFirst 'META-INF/*'
            pickFirst 'META-INF/**'
            pickFirst 'META-INF/INDEX.LIST'
            pickFirst 'META-INF/LICENSE'
            pickFirst 'META-INF/LICENSE.txt'
            pickFirst 'META-INF/NOTICE'
            pickFirst 'META-INF/DEPENDENCIES'
            pickFirst 'META-INF/NOTICE.txt'
            pickFirst 'META-INF/services/javax.ws.rs.ext.Providers'
        }
    }
    ios {
        infoPList = file('src/ios/Default-Info.plist')
        forceLinkClasses = [
                'com.gluonhq.**.*',
                'javax.annotations.**.*',
                'javax.inject.**.*',
                'javax.json.**.*',
                'org.glassfish.json.**.*'
        ]
    }
}

mainClassName = 'com.my.clientGUI.Main'
jar {
    manifest {
        attributes 'Main-Class': 'com.my.clientGUI.Main'
    }
    from {
        configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
    }
}

wrapper {
    gradleVersion = '6.0.1'
}

When I try to execute a gradle build I get the error:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'ClientGUI'.
> Could not create task ':debug'.
   > Unnecessarily replacing a task that does not exist is not supported.  Use create() or register() directly instead.  You attempted to replace a task named 'debug', but there is no existing task with that name.

I did not replace debug anywhere. Where is the problem? I already tried to delete the .gradle folder, did not help. Using Eclipse 4.14.

I want gradle 6 so I can use JDK 13.

Mark
  • 2,167
  • 4
  • 32
  • 64
  • May be one of the grade plugin is not compatible with the gradle version. – seenukarthi Feb 19 '20 at 03:50
  • @KarthikeyanVaithilingam I tested and removed them one by one. the error message changes to something else when i remove `org.javafxports.jfxmobile`. Does that mean I can't use it with gradle 6? – Mark Feb 19 '20 at 03:56
  • May be please check with gradle 5 or 4 and check. – seenukarthi Feb 19 '20 at 04:00
  • @KarthikeyanVaithilingam With 5 it works, but then I can't use java 13. – Mark Feb 19 '20 at 04:01
  • 1
    Then that the limitation that you have put up with until the plugin supports Gradle 6. I advice you to raise an issue on the plugin's github stating the plugin is not working in gradle 6 – seenukarthi Feb 19 '20 at 04:02
  • 1
    The issue comes from [this line](https://github.com/javafxports/javafxmobile-plugin/blob/master/src/main/groovy/org/javafxports/jfxmobile/plugin/JFXMobilePlugin.groovy#L277). However, jfxmobile (1.3+, 2.0+) is EOL, jfxmobile 2.0+ only works with Java 9/10. To run Java 11/13+, use the brand new Gluon [Client plugin](https://github.com/gluonhq/client-samples). – José Pereda Feb 20 '20 at 17:41
  • @JoséPereda thanks, I didn't know about this change. so now i need to use a different jdk distribution and switch from gradle to maven? Are there instructions for windows? I didn't find official documentation and the gluon mobile documentation from https://gluonhq.com/developers/documentation/ seems outdated. – Mark Feb 20 '20 at 18:17
  • The Client plugin is still WIP, mostly working for MacOS, Linux, and iOS, and somehow Android, Windows and Embedded, with focus on a Maven plugin for now. Documentation will be updated once the plugin is GA. – José Pereda Feb 20 '20 at 18:20
  • @JoséPereda i understand, so until the plugin is GA i need to stay with my current java version? – Mark Feb 20 '20 at 18:24
  • 1
    If you target Android, yes. If you target iOS, you can give it a go (there are already apps on the Store with the new plugin), knowing it is still under heavy development. – José Pereda Feb 20 '20 at 18:33

1 Answers1

1

The issue is that the plugin org.javafxports.jfxmobile is not compatible with Gradle 6. Downgrade Gradle version 5.

Since Gradle 5 do not support Java 13 you should also downgrade Java to Java 11.

seenukarthi
  • 8,241
  • 10
  • 47
  • 68