大家好,
我正在使用griffon创建一个使用javafx作为前端并以sqlite作为后端的项目。要连接到sqlite,我想使用ormlite插件。 我尝试使用[http://griffon-plugins.github.io/griffon-ormlite-plugin/]中的狮riff ormlite
问题1
我在 griffon-app / conf 文件夹中创建两个类 OrmliteConfig.groovy 和 BootstrapOrmlite.groovy 。这两个文件应该是自动生成的,但是没有生成,所以我创建了它们。
我的sqlite数据库 sample.db ,我已经将它们放在路径 griffon-app / resources / sample.db 中。我在OrmliteConfig.groovy中的代码是
database {
username = 'sa'
password = ''
}
environments {
development {
database {
url = 'jdbc:sqlite:sample.db'
}
}
test {
database {
url = 'jdbc:sqlite:sample.db'
}
}
production {
database {
url = 'jdbc:sqlite:sample.db'
}
}
}
问题1::连接到此sample.db的正确URL是什么? 有没有我可以引用的使用griffon + sqlite + javafx的好示例?
问题2
我刚刚尝试运行示例项目,当我运行gradle build时,出现以下错误:
Skipping task ':assemble' as it has no actions.
:assemble (Thread[Task worker for ':' Thread 2,5,main]) completed. Took 0.0 secs.
:compileFunctionalTestJava (Thread[Task worker for ':' Thread 2,5,main]) started.
:compileFunctionalTestJava
Putting task artifact state for task ':compileFunctionalTestJava' into context took 0.0 secs.
file or directory 'C:\Users\CH\.babun\cygwin\home\CH\ymalibrary\src\functionalTest\java', not found
Skipping task ':compileFunctionalTestJava' as it has no source files and no previous output files.
:compileFunctionalTestJava NO-SOURCE
:compileFunctionalTestJava (Thread[Task worker for ':' Thread 2,5,main]) completed. Took 0.0 secs.
:compileFunctionalTestGroovy (Thread[Task worker for ':' Thread 2,5,main]) started.
:compileFunctionalTestGroovy
Putting task artifact state for task ':compileFunctionalTestGroovy' into context took 0.0 secs.
file or directory 'C:\Users\CH\.babun\cygwin\home\CH\ymalibrary\src\functionalTest\groovy', not found
file or directory 'C:\Users\CH\.babun\cygwin\home\CH\ymalibrary\src\functionalTest\groovy', not found
Up-to-date check for task ':compileFunctionalTestGroovy' took 0.034 secs. It is not up-to-date because:
Task has failed previously.
file or directory 'C:\Users\CH\.babun\cygwin\home\CH\ymalibrary\src\functionalTest\groovy', not found
Starting process 'Gradle Worker Daemon 49'. Working directory: C:\Users\CH\.gradle\workers Command: C:\Program Files\Java\jdk1.8.0_112\bin\java.exe -Djava.security.manager=worker.org.gradle.process.internal.worker.child.BootstrapSecurityManager -Dfile.encoding=windows-1252 -Duser.country=IN -Duser.language=en -Duser.variant -cp C:\Users\CH\.gradle\caches\4.4.1\workerMain\gradle-worker.jar worker.org.gradle.process.internal.worker.GradleWorkerMain 'Gradle Worker Daemon 49'
Successfully started process 'Gradle Worker Daemon 49'
Started Gradle worker daemon (0.496 secs) with fork options DaemonForkOptions{executable=C:\Program Files\Java\jdk1.8.0_112\bin\java.exe, minHeapSize=null, maxHeapSize=null, jvmArgs=[], classpath=[C:\Users\CH\.gradle\caches\modules-2\files-2.1\org.codehaus.groovy\groovy-all\2.4.15\423a17aeb2f64bc6f76e8e44265a548bec80fd42\groovy-all-2.4.15.jar, C:\Users\CH\.babun\cygwin\home\CH\.sdkman\candidates\gradle\4.4.1\lib\ant-1.9.9.jar, C:\Users\CH\.babun\cygwin\home\CH\.sdkman\candidates\gradle\4.4.1\lib\ant-launcher-1.9.9.jar], keepAliveMode=SESSION}.
This JVM does not support getting OS memory, so no OS memory status updates will be broadcast
Initialized native services in: C:\Users\CH\.gradle\native
:compileFunctionalTestGroovy FAILED
:compileFunctionalTestGroovy (Thread[Task worker for ':' Thread 2,5,main]) completed. Took 1.119 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileFunctionalTestGroovy'.
> java.lang.ExceptionInInitializerError (no error message)
* Try:
Run with --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':compileFunctionalTestGroovy'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: java.lang.ExceptionInInitializerError
at org.gradle.api.internal.classloading.GroovySystemLoaderFactory.forClassLoader(GroovySystemLoaderFactory.java:44)
at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:97)
at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:56)
at org.gradle.api.internal.tasks.compile.daemon.AbstractDaemonCompiler$CompilerRunnable.run(AbstractDaemonCompiler.java:87)
at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:36)
at org.gradle.workers.internal.WorkerDaemonServer.execute(WorkerDaemonServer.java:46)
at org.gradle.workers.internal.WorkerDaemonServer.execute(WorkerDaemonServer.java:30)
at org.gradle.process.internal.worker.request.WorkerAction.run(WorkerAction.java:100)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:146)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:128)
at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:404)
... 3 more
Caused by: groovy.lang.GroovyRuntimeException: Conflicting module versions. Module [groovy-all is loaded in version 2.4.15 and you are trying to load version 2.4.12
... 16 more
* Get more help at https://help.gradle.org
BUILD FAILED in 5s
12 actionable tasks: 8 executed, 4 up-to-date
Stopped 1 worker daemon(s).
我看到Groovy的版本存在冲突,即2.4.12和2.4.15,我尝试了类似的方法
1.排除所有常规内容
2.将groovy版本强制为2.4.12
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileFunctionalTestGroovy'.
> java.lang.ExceptionInInitializerError (no error message)
* Try:
Run with --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':compileFunctionalTestGroovy'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: java.lang.ExceptionInInitializerError
at org.gradle.api.internal.classloading.GroovySystemLoaderFactory.forClassLoader(GroovySystemLoaderFactory.java:44)
at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:97)
at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:56)
at org.gradle.api.internal.tasks.compile.daemon.AbstractDaemonCompiler$CompilerRunnable.run(AbstractDaemonCompiler.java:87)
at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:36)
at org.gradle.workers.internal.WorkerDaemonServer.execute(WorkerDaemonServer.java:46)
at org.gradle.workers.internal.WorkerDaemonServer.execute(WorkerDaemonServer.java:30)
at org.gradle.process.internal.worker.request.WorkerAction.run(WorkerAction.java:100)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:146)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:128)
at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:404)
... 3 more
Caused by: groovy.lang.GroovyRuntimeException: Conflicting module versions. Module [groovy-all is loaded in version 2.4.15 and you are trying to load version 2.4.12
... 16 more
* Get more help at https://help.gradle.org
BUILD FAILED in 9s
12 actionable tasks: 9 executed, 3 up-to-date
Stopped 1 worker daemon(s).
他们都不在工作
问题2
如何解决此错误,即gradle依赖问题。
我的 gradle.properties 是
group = van.bethel
version = 1.0
groovyVersion = 2.4.15
slf4jVersion = 1.7.25
spockVersion = 1.1-groovy-2.4
我的 build.gradle 是
buildscript {
repositories {
jcenter()
mavenLocal()
}
dependencies {
classpath 'org.codehaus.griffon:gradle-griffon-plugin:2.15.1'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.2'
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0'
classpath 'org.gradle.api.plugins:gradle-izpack-plugin:0.2.3'
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.4'
classpath 'com.github.cr0:gradle-macappbundle-plugin:3.1.0'
classpath 'org.kordamp.gradle:stats-gradle-plugin:0.2.2'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.17.0'
classpath 'de.gliderpilot.gradle.jnlp:gradle-jnlp-plugin:1.2.5'
classpath 'net.nemerosa:versioning:2.6.1'
}
}
apply plugin: 'groovy'
apply plugin: 'org.codehaus.griffon.griffon'
apply plugin: 'net.nemerosa.versioning'
Date buildTimeAndDate = new Date()
ext {
buildDate = new SimpleDateFormat('yyyy-MM-dd').format(buildTimeAndDate)
buildTime = new SimpleDateFormat('HH:mm:ss.SSSZ').format(buildTimeAndDate)
macosx = System.getProperty('os.name').contains('Mac OS')
}
griffon {
disableDependencyResolution = false
includeGroovyDependencies = true
version = '2.12.0'
toolkit = 'javafx'
applicationProperties = [
'build_date' : buildDate,
'build_time' : buildTime,
'build_revision': versioning.info.commit
]
}
mainClassName = 'van.bethel.Launcher'
apply from: 'gradle/publishing.gradle'
apply from: 'gradle/code-coverage.gradle'
apply from: 'gradle/code-quality.gradle'
apply from: 'gradle/javafx-plugin.gradle'
apply from: 'gradle/integration-test.gradle'
apply from: 'gradle/functional-test.gradle'
apply from: 'gradle/package.gradle'
apply from: 'gradle/docs.gradle'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'org.kordamp.gradle.stats'
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'com.github.kt3k.coveralls'
jfx {
mainClass = mainClassName
allPermissions = true
keyStoreAlias = 'example-user'
keyStorePassword = 'example-password'
jfxMainAppJarName = jar.archiveName
appName = project.name
vendor = project.name
}
dependencies {
compile "org.codehaus.griffon:griffon-guice:${griffon.version}"
griffon 'org.codehaus.griffon.plugins:griffon-ormlite-plugin:2.1.0'
runtime "org.slf4j:slf4j-simple:${slf4jVersion}"
testCompile "org.codehaus.griffon:griffon-javafx-test:${griffon.version}"
testCompile "org.codehaus.groovy:groovy-all:${groovyVersion}"
testCompile "org.spockframework:spock-core:${spockVersion}"
testCompile('org.awaitility:awaitility-groovy:3.1.0') {
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
}
functionalTestCompile "org.codehaus.griffon:griffon-javafx-test:${griffon.version}"
}
task sourceJar(type: Jar) {
group 'Build'
description 'An archive of the source code'
classifier 'sources'
from sourceSets.main.allSource
}
tasks.withType(JavaCompile) {
sourceCompatibility = project.sourceCompatibility
targetCompatibility = project.targetCompatibility
}
tasks.withType(GroovyCompile) {
sourceCompatibility = project.sourceCompatibility
targetCompatibility = project.targetCompatibility
}
import com.github.jengelman.gradle.plugins.shadow.transformers.*
import java.text.SimpleDateFormat
shadowJar {
transform(ServiceFileTransformer)
transform(ServiceFileTransformer) {
path = 'META-INF/griffon'
}
transform(ServiceFileTransformer) {
path = 'META-INF/types'
}
transform(PropertiesFileTransformer) {
paths = [
'META-INF/editors/java.beans.PropertyEditor'
]
}
}
startScripts {
doLast {
if (!macosx) unixScript.text = unixScript.text.replaceAll('"(-Xdock:(name|icon)=)([^"]*?)(")', ' ')
windowsScript.text = windowsScript.text.replaceAll('"(-Xdock:(name|icon)=)([^"]*?)(")', ' ')
}
}
if (hasProperty('debugRun') && ((project.debugRun as boolean))) {
run {
jvmArgs '-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005'
}
}
task jacocoRootMerge(type: org.gradle.testing.jacoco.tasks.JacocoMerge, dependsOn: [test, jacocoTestReport, jacocoIntegrationTestReport, jacocoFunctionalTestReport]) {
executionData = files(jacocoTestReport.executionData, jacocoIntegrationTestReport.executionData, jacocoFunctionalTestReport.executionData)
destinationFile = file("${buildDir}/jacoco/root.exec")
}
task jacocoRootReport(dependsOn: jacocoRootMerge, type: JacocoReport) {
group = 'Reporting'
description = 'Generate Jacoco coverage reports after running all tests.'
executionData file("${buildDir}/jacoco/root.exec")
sourceDirectories = files(sourceSets.main.allSource.srcDirs)
classDirectories = files(sourceSets.main.output)
reports {
csv.enabled = false
xml.enabled = true
html.enabled = true
html.destination = file("${buildDir}/reports/jacoco/root/html")
xml.destination = file("${buildDir}/reports/jacoco/root/root.xml")
}
}
BUILD SUCCESSFUL in 4s
1 actionable task: 1 executed
预先感谢