what is the diference over org.javafxports » jfxmobile-plugin 1.3.16 and 2.0.30 - gluon

what is the diference over org.javafxports jfxmobile-plugin 1.3.16 and 2.0.30
I try update the version 1.3.16 to 2.0.30 but not compile project

The jfxmobile-plugin is a gradle plugin that unifies the building of Java and JavaFX applications for different target platforms:
desktop
android
ios
embedded
JFXMobile plugin comes in two flavors:
jfxmobile 1.3.16
See Maven central, and its repository.
Samples: See Gluon Mobile samples
A typical build:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.3.16'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
jcenter()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
dependencies {
compile 'com.gluonhq:charm:5.0.0'
}
jfxmobile 2.0.30
See Maven central, and its repository.
Samples for Gluon VM: See Gluon Mobile with Gluon VM samples.
A typical build:
buildscript {
repositories {
google()
jcenter()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:2.0.30'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
jcenter()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile 'com.gluonhq:charm:5.0.0-jdk9'
androidRuntime 'com.gluonhq:charm:5.0.0'
}
Differences
As you can see in the readme for plugin 2.x:
javafxmobile-plugin version 1.x brought Java 8 to mobile development. Version 2.x is an upgrade of the plugin that enables Java 9 development by leveraging Gluon VM.
And:
Gluon VM is still in active development and is at the moment only supported on iOS devices.
Currently it is under developer preview.
Summary
If you want to develop an application for production, use the stable 1.x version, with Java 8, for both Android and iOS, where most of the Java 7 SE APIs are available, and a few Java 8 APIs are supported as well (like lambdas). Streams are not supported though.
If you want to experiment with Java 9 features, use the new 2.x version. It supports Streams, and Java 9. Note that on Android Java 9 APIs are not supported and it has to be compatible with Java 8.

Related

Gradle and Dependencies supported Java version

How do I make sure that the dependencies I use in Gradle are compatible with a given Java version?
For example, I created an application that uses GraalVM. In Gradle I specify:
implementation 'org.graalvm.js:js:22.2.0'
implementation 'org.graalvm.js:js-scriptengine:22.2.0'
When executing the code I get:
Error loading driver /Users/yusuf-mac/.DbSchema/drivers/MongoDb/truffle-api-22.2.0.jar : java.lang.UnsupportedClassVersionError: META-INF/versions/17/module-info has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 59.0.
Please consider upgrading Java. Your current Java version is AdoptOpenJDK 15.0.2.
How do I ensure in Gradle that the dependencies are compatible with OpenJDK 15? I cannot upgrade to a higher version of OpenJDK. Is any way to make sure that the dependency version 22.2.0 is compatible with OpenJDK 15?
Here the complete build.gradle
buildscript {
repositories {
mavenCentral()
}
}
plugins{
id "java"
id 'org.hidetake.ssh' version '2.7.1'
}
apply plugin: 'application'
apply plugin: 'distribution'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(15)
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.mongodb:mongodb-driver-sync:4.7.1'
implementation 'org.graalvm.js:js:22.2.0'
implementation 'org.graalvm.js:js-scriptengine:22.2.0'
implementation 'com.google.code.gson:gson:2.9.0'
testImplementation 'junit:junit:4.13.2'
//implementation "org.graalvm.sdk:graal-sdk:22.0.0.2"
//implementation "org.graalvm.truffle:truffle-api:22.0.0.2"
}
compileJava{
doFirst {
options.compilerArgs = [
'--module-path', classpath.asPath,
]
}
}
jar {
archiveName ="mongojdbc${version}.jar"
manifest {
attributes 'Main-Class': 'com.wisecoders.dbschema.mongodb.JdbcDriver'
attributes 'Class-Path': configurations.runtimeClasspath.files.collect { it.getName() }.join(' ')
attributes 'Specification-Version': "$version"
attributes 'Specification-Vendor': "Wise Coders"
attributes 'Implementation-Vendor-Id': "dbschema.com"
attributes 'Implementation-Vendor': "Wise Coders"
attributes 'Implementation-Version': new Date().format( 'yyMMdd' )
}
}
task zip(type: Zip, dependsOn:['clean','jar']) {
archiveFileName.set 'MongoDbJdbcDriver.zip'
from configurations.runtimeClasspath.allArtifacts.files
from configurations.runtimeClasspath
from "build/libs" include "*.jar"
}
I was unable to reproduce this behavior in a sample project I created - https://github.com/alexanderankin/so-73508929 - including this library and its use.
I've also included the gradle tool chain api reference in the build.gradle script in my project to show how you would restrict the java version your project is validated against, although I'm pretty sure it would be easier to use a tool like sdkman to quickly switch between java versions.
Your error message also indicates that the jar is coming from a mongo folder, so maybe its from something else in that project/environment.

Gradle cannnot resolve some dependencies while Maven can

I have a Gradle project that requires org.eclipse.hudson:hudson-core:3.3.3. It has been working fine until today, when it just says:
Could not resolve org.eclipse.hudson:hudson-remoting:3.0.3
I created a Maven project with only hudson-remoting:3.0.3, it works fine. The jar is also there on the Maven Central. Gradle is able to resolve hudson-remoting:3.0.2 though, but hudson-core:3.3.3 requires hudson-remoting:3.0.3. What is going on?
plugins {
id 'java'
}
group 'org.example'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.eclipse.hudson:hudson-remoting:3.0.3'
}
The projects uses bundled Gradle 6.8, created by IntelliJ.

Corda - Version Upgrade & Gradle Tooling Issues

I've just upgraded a Corda project from 4.1 to 4.3 however there are unresolved dependencies, specifically
org.gradle:gradle-tooling-api:5.4.1
Which is required by
net.corda:corda-node-driver:4.3
The following repositories are enabled in my build.gradle configuration
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven { url 'https://jitpack.io' }
maven { url 'https://software.r3.com/artifactory/corda' }
}
This seems to happen almost every time I perform a Corda version upgrade, and I've yet to fully understand why...
Took a little digging but this was missing from my repositories configuration...
maven { url 'https://repo.gradle.org/gradle/libs-releases' }

gluon-mobile plugin cannot handle multi-release jars

Deploying one of my example JavaFX applications to an Android device via the gluon-mobile Eclipse plugin fails with an IllegalArgumentException in the retrolambda plugin. This is caused by an indirect dependency of my project on jaxb-api-2.3.0.jar which is a multi-release jar. Retrolambda obviously cannot handle the Java 9 parts in this file and instead of just ignoring them throws an exception. How can this be fixed or avoided?
A newer version of retrolambda (2.5.3 instead of 2.5.1) can handle the module-info.class already but not the part in the META-INF/versions/9/...
The problem could be cured by just deleting the META-INF stuff but when I do that manually it is always re-created by the gluon plugin.
Update 1:
Adding
packagingOptions {
exclude '/META-INF/versions/9/javax/xml/bind/ModuleUtil.class'
}
to the android section in the build file does not make any difference. The error message is still the same:
java.lang.IllegalArgumentException
at net.orfjackal.retrolambda.asm.ClassReader.<init>(ClassReader.java:185)
at net.orfjackal.retrolambda.asm.ClassReader.<init>(ClassReader.java:168)
at net.orfjackal.retrolambda.ClassAnalyzer.analyze(ClassAnalyzer.java:25)
at net.orfjackal.retrolambda.Retrolambda$1.visitClass(Retrolambda.java:71)
at net.orfjackal.retrolambda.files.ClasspathVisitor.visitFile(ClasspathVisitor.java:29)
at net.orfjackal.retrolambda.files.ClasspathVisitor.visitFile(ClasspathVisitor.java:11)
at java.nio.file.Files.walkFileTree(Files.java:2670)
at java.nio.file.Files.walkFileTree(Files.java:2742)
at net.orfjackal.retrolambda.Retrolambda.visitFiles(Retrolambda.java:107)
at net.orfjackal.retrolambda.Retrolambda.run(Retrolambda.java:68)
at net.orfjackal.retrolambda.Main.main(Main.java:28)
This can also be verified easily by just running the command line version of retrlambda over the extracted classes of jaxb-api-2.3.0.jar
Update 2:
With Java 9 and the Gluon-VM it fails with:
Execution failed for task ':SingleViewProject - Gluon VMApp:apkDebug'.
> Duplicate files at the same path inside the APK: META-INF/LICENSE.txt
File 1: /Users/mpaus/.m2/repository/org/apache/commons/commons-math3/3.6.1/commons-math3-3.6.1.jar
File 2: /Users/mpaus/.m2/repository/javax/xml/bind/jaxb-api/2.3.0/jaxb-api-2.3.0.jar
jaxb-api-2.3.0.jar is a multi-release jar and the current jfxmobile plugin 1.3.10 can't deal with it.
The plugin, that targets Java 7/8, uses retrolambda to port back to Java 6/7 a given dependency.
Even if you try to remove the module-info.class or the 9 versionMETA-INF.versions.9.javax.xml.bind`, these classes are processed by the retrolambda plugin, and this will lead to the exception posted in the question. Using the latest retrolambda version doesn't help either.
android {
retrolambdaVersion = "2.5.3"
manifest = 'src/android/AndroidManifest.xml'
packagingOptions {
exclude '/module-info.class'
exclude '/META-INF.versions.9.javax.xml.bind/ModuleUtil.class'
}
}
The only way to make it work under Java 8/jfxmobile 1.3.10 is by modifying the plugin, to add the following exception to JFXMobilePlugin:
copyClassesForRetrolambda.include '**/*.class'
copyClassesForRetrolambda.includeEmptyDirs = false
// exception for multi-release jars
copyClassesForRetrolambda.exclude 'META-INF/versions/**/*.class'
copyClassesForRetrolambda.exclude 'module-info.class'
and then build the plugin and use a local snapshot.
The good news is that using the jfxmobile plugin version 2.0.20 and Gluon VM, that targets Java 9+, the above is already included.
If you can switch to Java 9/10, modify your project to use this plugin, create a new project with the Gluon IDE plugin ('single view project with Gluon VM'), or follow this sample, but using the latest version (2.0.20 so far).
buildscript {
repositories {
jcenter()
google()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:2.0.20'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
jcenter()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
mainClassName = '...'
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile 'com.gluonhq:charm:5.0.0-jdk9'
androidRuntime 'com.gluonhq:charm:5.0.0'
compile 'javax.xml.bind:jaxb-api:2.3.0'
}

Building a Spring-boot project without eclipse gradle

I'm fairly new to gradle and writing a project that I have working in eclipse and was posed with the challenge to write it without eclipse using gradle. I'm finding that even once I add the spring framework configurations to my build file it still can not see what I am importing. I am also using maven so I think it my understanding of gradle changing from a maven project and with SQL. Any thoughts?
Here is my build.gradle:
plugins {
id "org.springframework.boot" version "1.5.9.RELEASE"
id "io.spring.dependency-management" version "1.0.4.RELEASE"
}
apply plugin: 'java'
repositories {
jcenter()
mavenCentral()
}
// spring dependency management plugin configuration
dependencyManagement {
imports {
// select versions based on this BOM
mavenBom 'io.spring.platform:platform-bom:1.1.1.RELEASE'
}
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-web')
compile("org.springframework:spring-jdbc")
compile('mysql:mysql-connector-java:5.1.37')
}
You need to add spring boot dependencies.
like:
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
}
See the Spring documentation:
https://spring.io/guides/gs/spring-boot/#scratch

Resources