I have uses the Browser Service for Gluon charm down. But It not work. Someone can help me please? I don't have any Error . That is my Build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.3.1'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
jcenter()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
mainClassName = 'com.gluonapplication.GluonApplication'
dependencies {
compile 'com.gluonhq:charm:4.2.0'
androidRuntime 'org.sqldroid:sqldroid:1.0.3'
androidCompile 'org.glassfish:javax.json:1.0.4'
androidRuntime 'com.google.zxing:core:3.2.1'
compile group: 'org.xerial', name: 'sqlite-jdbc', version: '3.15.1'
compile group: 'org.sqldroid', name: 'sqldroid', version: '1.0.3'
compile group: 'com.gluonhq', name: 'charm-down-desktop', version: '0.0.2'
compile group: 'com.gluonhq', name: 'charm-down-common', version: '0.0.1'
compile group: 'com.gluonhq', name: 'charm-down-android', version: '0.0.1'
compileNoRetrolambda 'com.airhacks:afterburner.mfx:1.6.2'
compile group: 'com.gluonhq', name: 'charm-down-plugin-browser', version: '3.2.0'
compile group: 'com.gluonhq', name: 'charm-down-plugin-barcode-scan-android', version: '3.2.0'
compile group: 'com.gluonhq', name: 'charm-down-plugin-battery', version: '3.2.0'
compile group: 'com.gluonhq', name: 'charm-down-plugin-dialer-android', version: '3.2.0'
compile group: 'com.gluonhq', name: 'charm-down-plugin-pictures', version: '3.2.0'
compile group: 'com.gluonhq', name: 'charm-down-plugin-position', version: '3.2.0'
}
jfxmobile {
downConfig {
version = '3.1.0'
plugins 'cache','display', 'lifecycle', 'statusbar', 'storage'
}
android {
manifest = 'src/android/AndroidManifest.xml'
applicationPackage = 'org.javafxports.ensemble'
}
ios {
infoPList = file('src/ios/Default-Info.plist')
forceLinkClasses = [
'com.gluonapplication.**.*',
'com.gluonhq.**.*',
'javax.annotations.**.*',
'javax.inject.**.*',
'javax.json.**.*',
'org.glassfish.json.**.*',
'ensemble.**.*'
]
}
}
and i have implemented the Service like so
public void browser() {
Services.get(BrowserService.class).ifPresent(service -> {
try {
service.launchExternalBrowser("www.google.com");
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
});
}
After i add it in a Button to the Scene Builder
The Position and Barcode-Scan Plugin do not works also fine
Here is how i have implemented it.
public void position() {
Services.get(PositionService.class).ifPresent(service -> {
Position position = service.getPosition();
System.out.printf("Current position: %.5f, %.5f", position.getLatitude(), position.getLongitude());
LS4.setText(position.getLatitude() + " /" + position.getLongitude() + "");
});
}
public void barCode() {
Services.get(BarcodeScanService.class).ifPresent(service -> {
BarcodeScanService barcodeScanService = (BarcodeScanService) new BarcodeScanServiceFactory();
Optional<String> barcode = barcodeScanService.scan();
barcode.ifPresent(barcodeValue -> LS4.setText(barcodeValue));
});
}
and that is my androidmanifest
<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.gluonapplication" android:versionCode="1" android:versionName="1.0">
<supports-screens android:xlargeScreens="true"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="21"/>
<application android:label="MultiViewProjectFXML" android:name="android.support.multidex.MultiDexApplication" android:icon="#mipmap/ic_launcher">
<activity android:name="javafxports.android.FXActivity" android:labe
l="MultiViewProjectFXML" android:configChanges="orientation|screenSize">
Your build contains wrong dependencies, and the plugins should be managed by the downConfig configuration.
It will take care of adding the proper plugins and for the proper platform.
Modify your dependencies and plugins like this:
dependencies {
compile 'com.gluonhq:charm:4.3.0'
androidRuntime 'org.sqldroid:sqldroid:1.0.3'
androidCompile 'org.glassfish:javax.json:1.0.4'
androidRuntime 'com.google.zxing:core:3.2.1'
desktopCompile group: 'org.xerial', name: 'sqlite-jdbc', version: '3.15.1'
desktopCompile group: 'org.sqldroid', name: 'sqldroid', version: '1.0.3'
compile 'com.airhacks:afterburner.mfx:1.6.3'
}
jfxmobile {
downConfig {
version = '3.2.0'
plugins 'barcode-scan', 'battery', 'browser', 'cache', 'dialer', 'display', 'lifecycle', 'picture', 'position', 'statusbar', 'storage'
}
}
As for the Browser service, you'll need to include http://.
Related
I'm trying to create a TornadoFx project in IntelliJ ide..
on build it shows the error
Error: JavaFX runtime components are missing, and are required to run this application
here's the build.gradle file
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.3.40'
id 'org.openjfx.javafxplugin' version '0.0.7'
}
javafx {
version = "12"
modules = ['javafx.controls', 'javafx.base', 'javafx.fxml', 'javafx.graphics']
}
group 'tornado1'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
testCompile group: 'junit', name: 'junit', version: '4.12'
implementation 'no.tornado:tornadofx:1.7.19'
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
and a screenshot of the libraries in the project structure
In my Gradle project, I have a dependency for SQLite.
Here is my build.gradle:
import groovy.sql.Sql
buildscript {
ext{
osPackageVersion = "3.4.0"
kotlin_version = '1.2.41'
requery_version = '1.5.1'
sqlite_jdbc = '3.7.2'
rxkotlin_version = '2.2.0'
sqlDirPath = "src" + File.separator + "main" + File.separator + "Resources" + File.separator + "TestAppDbInit.sql"
}
repositories {
mavenCentral()
jcenter()
maven{
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "edu.sc.seis.gradle:launch4j:2.4.4"
classpath group: 'org.jooq', name: 'jooq-meta-extensions', version: '3.11.2'
classpath 'org.jooq:jooq-codegen:3.11.2'
classpath 'org.xerial:sqlite-jdbc:3.7.2'
}
}
plugins {
id 'java'
id 'nu.studer.jooq' version '3.0.1'
}
group 'org.wycliffeassociates.translationrecorder'
apply plugin: 'kotlin'
apply plugin: 'kotlin-kapt'
apply plugin: 'edu.sc.seis.launch4j'
sourceCompatibility = 1.8
configurations {
sqllite
}
repositories {
mavenCentral()
jcenter()
maven { url 'https://jitpack.io'}
maven { url "https://plugins.gradle.org/m2/" }
maven { url 'https://mvnrepository.com/artifac/'}
maven { url "https://dl.bintray.com/kotlin/exposed" }
maven { url "https://dl.bintray.com/dua3/public" }
}
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
dependencies {
compile "no.tornado:tornadofx:1.7.16"
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
compile "com.github.thomasnield:rxkotlinfx:2.2.2"
compile "io.reactivex.rxjava2:rxkotlin:$rxkotlin_version"
compile 'org.jooq:jooq:3.11.2'
compile group: 'org.xerial', name: 'sqlite-jdbc', version: "$sqlite_jdbc"
jooqRuntime group: 'org.jooq', name: 'jooq-meta-extensions', version: '3.11.2'
jooqRuntime 'org.xerial:sqlite-jdbc:3.7.2'
sqllite 'org.xerial:sqlite-jdbc:3.7.2'
kapt "io.requery:requery-processor:$requery_version"
compile "com.squareup.retrofit2:retrofit:2.0.0"
compile "com.squareup.retrofit2:converter-moshi:2.0.0"
compile 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
compile 'com.google.dagger:dagger:2.16'
kapt 'com.google.dagger:dagger-compiler:2.16'
implementation 'com.github.WycliffeAssociates:8woc2018-common:dev-SNAPSHOT'
compile 'com.github.WycliffeAssociates:jdenticon-kotlin:-SNAPSHOT'
compile 'de.jensd:fontawesomefx-commons:9.1.2-jpms'
compile 'de.jensd:fontawesomefx-materialicons:2.2.0-9.1.2-jpms'
compile 'de.jensd:fontawesomefx-icons525:4.2.0-9.1.2-jpms'
compile 'com.github.afester.FranzXaver:Examples:0.1'
compile 'com.jfoenix:jfoenix:8.0.5' // Java 8
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile "org.mockito:mockito-core:2.+"
testCompile "org.mockito:mockito-core:2.+"
testCompile 'org.powermock:powermock-module-junit4:2.+'
testCompile 'org.powermock:powermock-module-junit4-rule:2.+'
testCompile 'org.powermock:powermock-api-mockito2:2.+'
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
URLClassLoader loader = GroovyObject.class.classLoader
configurations.sqllite.each { File file ->
loader.addURL(file.toURL())
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
I try to run the build for the project, and I get the following error:
Caused by: org.gradle.api.InvalidUserDataException: Cannot change strategy of configuration ':sqllite' after it has been resolved.
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.preventIllegalMutation(DefaultConfiguration.java:896)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.validateMutation(DefaultConfiguration.java:867)
at org.gradle.api.internal.artifacts.ivyservice.resolutionstrategy.DefaultCachePolicy.eachModule(DefaultCachePolicy.java:161)
at org.gradle.api.internal.artifacts.ivyservice.resolutionstrategy.DefaultCachePolicy.cacheChangingModulesFor(DefaultCachePolicy.java:121)
at org.gradle.api.internal.artifacts.ivyservice.resolutionstrategy.DefaultResolutionStrategy.cacheChangingModulesFor(DefaultResolutionStrategy.java:190)
at org.gradle.api.internal.artifacts.ivyservice.resolutionstrategy.DefaultResolutionStrategy.cacheChangingModulesFor(DefaultResolutionStrategy.java:186)
at org.gradle.api.artifacts.ResolutionStrategy$cacheChangingModulesFor.call(Unknown Source)
at build_2rl70kyg6ax354v7xbsnpa8n1$_run_closure8.doCall(C:\Users\dipinton\8woc2018-jvm\build.gradle:114)
at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:71)
at org.gradle.util.ConfigureUtil.configureTarget(ConfigureUtil.java:155)
at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:106)
at org.gradle.util.ConfigureUtil$WrappedConfigureAction.execute(ConfigureUtil.java:167)
at org.gradle.api.internal.DefaultDomainObjectCollection.all(DefaultDomainObjectCollection.java:158)
at org.gradle.api.internal.DefaultDomainObjectCollection.all(DefaultDomainObjectCollection.java:174)
at org.gradle.api.DomainObjectCollection$all.call(Unknown Source)
at build_2rl70kyg6ax354v7xbsnpa8n1.run(C:\Users\dipinton\8woc2018-jvm\build.gradle:113)
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:90)
... 99 more
It's my impression that this error I'm receiving has to do with the fact that I have 2 configurations blocks. One for configuring my SQLite module, and another for handling the resolution strategy of all modules. These two closures seem to be conflicting with one another.
Does anyone have any suggestions on how to remove the conflict between these two closures?
This working with addUrl on the copy of configuration:
def sqliteCopy = configurations.sqlite.copy()
sqliteCopy.each {File file ->
loader.addURL(file.toURI().toURL())
}
instead of:
configurations.sqllite.each { File file ->
loader.addURL(file.toURL())
}
or downgrade com.android.tools.build:gradle to 3.1.4 version.
I am using gretty as my container for building my spring project . But when i issue the command gradle clean or gradle jettyRun ,i am getting the following problem
Cannot add task ':jettyRun' as a task with that name already exists.
PFB my build.gradle file
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'eclipse-wtp'
apply plugin: 'jetty' //too old, Jetty6, use gretty
apply plugin: 'org.akhikhl.gretty'
apply plugin: 'idea'
apply plugin: 'jacoco' //code coverage
def springVersion = "4.2.4.RELEASE"
def jdkVersion = 1.8
def junitVersion = "4.12"
def logbackVersion = "1.1.3"
def jclOverSlf4jVersion = "1.7.14"
def jstlVersion = "1.2"
def hamcrestVersion = "1.3"
def servletApiVersion = "3.1"
sourceCompatibility = jdkVersion
targetCompatibility = jdkVersion
repositories {
mavenLocal()
mavenCentral()
}
task wrapper(type: Wrapper) {
gradleVersion = '2.10'
}
configurations.all {
exclude group: "commons-logging", module: "commons-logging"
}
dependencies {
compile 'org.slf4j:jcl-over-slf4j:' + jclOverSlf4jVersion
compile 'ch.qos.logback:logback-classic:' + logbackVersion
compile 'org.springframework:spring-webmvc:' +springVersion
compile 'javax.servlet:jstl:' + jstlVersion
compile 'org.springframework:spring-test:' + springVersion
//exclude the build in hamcrest
testCompile('junit:junit:' + junitVersion) {
exclude group: 'org.hamcrest'
}
testCompile 'org.hamcrest:hamcrest-library:' + hamcrestVersion
//include in compile only, exclude in the war
providedCompile 'javax.servlet:javax.servlet-api:' + servletApiVersion
}
//Gretty
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.akhikhl.gretty:gretty:+'
}
}
gretty {
//port = 9000
contextPath = 'loanSharks'
servletContainer = 'jetty9'
}
//For Eclipse IDE only
eclipse {
wtp {
component {
//define context path, default to project folder name
contextPath = 'loanSharks'
}
}
}
jacoco {
toolVersion = "0.7.5+"
reportsDir = file("$buildDir/reports/jacoco")
}
jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
}
}
Even removes plugin: 'jetty', but I am being still with the error:
Execution failed for task ':jettyRun'.
Cannot call TaskInputs.property(String, Object) on task ':jettyRun' after task has started execution.
I would like to add 'release' task:
grunt.initConfig({
...
shell: {
release: {
command: function(version) {
return 'git checkout -b release-' + version + ' devel';
}
}
}
...
grunt.loadNpmTasks('grunt-bumpup');
grunt.loadNpmTasks('grunt-shell');
...
grunt.registerTask('release', function() {
grunt.task.run('bumpup');
var version = grunt.config.get('pkg').version;
grunt.task.run('shell:release:' + version);
});
But I have the following:
Running "release" task
Running "bumpup" task
Bumped to: 1.2.5
Running "shell:release:1.2.4" (shell) task
Switched to a new branch 'release-1.2.4'
M Gruntfile.js
M package.json
M src/manifest.json
Done, without errors.
So the version was bumped up, but branch was created for previous version.
I think it is because package.json cached. Can I reread it?
var version = grunt.file.readJSON('package.json').version; // old version too
EDIT:
Adding 'updateProps' to bumpup config will change pkg version property, but:
grunt.registerTask('release', function() {
grunt.task.run('bumpup');
var version = grunt.config.get('pkg').version;
grunt.log.writeln(version); // old version, because tasks run async?
grunt.task.run('shell:release:' + version);
});
Works good:
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
...
bumpup: {
options: {
updateProps: {
pkg: 'package.json'
}
},
files: ['package.json', 'src/manifest.json']
},
shell: {
release: {
command: function() {
return 'git checkout -b release-' + grunt.config.get('pkg').version + ' devel';
}
}
},
...
grunt.loadNpmTasks('grunt-bumpup');
grunt.loadNpmTasks('grunt-shell');
...
grunt.registerTask('release', ['lint', 'bumpup', 'shell:release']);
Are you sure to have set the updateProps option of the grunt-bumpup plugin? This will allow you to specify files to update with the new bumped version after your bumpup task is completed
grunt.initConfig({
...
bumpup: {
options: {
updateProps: {
pkg: 'package.json'
}
},
file: 'package.json'
}
...
});
I want to use Qbs to compile an existing project. This project already contains a code-transformation-tool (my_tool) that is used heavily in this project.
So far I have (simplified):
import qbs 1.0
Project {
Application {
name: "my_tool"
files: "my_tool/main.cpp"
Depends { name: "cpp" }
}
Application {
name: "my_app"
Group {
files: 'main.cpp.in'
fileTags: ['cpp_in']
}
Depends { name: "cpp" }
Rule {
inputs: ["cpp_in"]
Artifact {
fileName: input.baseName
fileTags: "cpp"
}
prepare: {
var mytool = /* Reference to my_tool */;
var cmd = new Command(mytool, input.fileName, output.fileName);
cmd.description = "Generate\t" + input.baseName;
cmd.highlight = "codegen";
return cmd;
}
}
}
}
How can I get the reference to my_tool for the command?
This answer is based on an email from Qbs author Joerg Bornemann who allowed me to cite it here.
The property usings of Rule allows to add artifacts from products dependencies to the inputs.
In this case we are interested in "application" artifacts.
The list of applications could then be accessed as input.application.
Application {
name: "my_app"
Group {
files: 'main.cpp.in'
fileTags: ['cpp_in']
}
Depends { name: "cpp" }
// we need this dependency to make sure that my_tool exists before building my_app
Depends { name: "my_tool" }
Rule {
inputs: ["cpp_in"]
usings: ["application"] // dependent "application" products appear in inputs
Artifact {
fileName: input.completeBaseName
fileTags: "cpp"
}
prepare: {
// inputs["application"] is a list of "application" products
var mytool = inputs["application"][0].fileName;
var cmd = new Command(mytool, [inputs["cpp_in"][0].fileName, output.fileName]);
cmd.description = "Generate\t" + input.baseName;
cmd.highlight = "codegen";
return cmd;
}
}
}
Unfortunately the usings property in a Rule is deprecated since QBS 1.5.0. At the moment I have the same requirement. Using a product artifact in a non multiplex Rule.
The problem with a multiplex Rule is, if a single file in the input set changes, all input artifacts will be re-processed. Which is rather time consuming in my case.