我正在尝试使用 ObjectBox 作为 Spring Boot 和 Tomcat 的服务器数据库当我使用 Spring Boot 的嵌入式 tomcat 服务器时,它工作正常(直接从 IntelliJ IDEA 运行),
但是,当我将 WAR 文件/展开的 API 部署到 Tomcat 时,我收到错误“java.library.path 中没有 objectbox-jni-windows-x64”
我确实安装了 Microsoft Visual C++ 2017
你能帮我成功部署它吗?
以下是我的 build.gradle 文件:
buildscript {
ext {
kotlinVersion = '1.3.10'
springBootVersion = '2.1.1.RELEASE'
objectboxVersion = '2.2.0'
}
repositories {
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
jcenter()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}")
classpath "io.objectbox:objectbox-gradle-plugin:$objectboxVersion"
classpath "net.ltgt.gradle:gradle-apt-plugin:0.15"
}
}
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.3.10'
}
apply plugin: 'application'
apply plugin: 'kotlin'
apply plugin: 'kotlin-spring'
apply plugin: 'eclipse-wtp'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'war'
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'io.objectbox'
apply plugin: 'kotlin-kapt'
apply plugin: 'net.ltgt.apt-idea'
group = 'com.techontouch'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
mainClassName = "ScoresOnTouchApplicationKt"
compileKotlin {
kotlinOptions {
freeCompilerArgs = ["-Xjsr305=strict"]
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
freeCompilerArgs = ["-Xjsr305=strict"]
jvmTarget = "1.8"
}
}
repositories {
mavenCentral()
jcenter()
}
configurations {
providedRuntime
}
dependencies {
implementation('org.springframework.boot:spring-boot-starter-actuator')
implementation('org.springframework.boot:spring-boot-starter-data-rest')
implementation('org.springframework.boot:spring-boot-starter-web')
implementation('com.fasterxml.jackson.module:jackson-module-kotlin')
providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
testImplementation('org.springframework.boot:spring-boot-starter-test')
implementation "io.objectbox:objectbox-java:$objectboxVersion"
implementation "io.objectbox:objectbox-kotlin:$objectboxVersion"
kapt "io.objectbox:objectbox-processor:$objectboxVersion"
implementation "io.objectbox:objectbox-linux:$objectboxVersion"
implementation "io.objectbox:objectbox-macos:$objectboxVersion"
implementation "io.objectbox:objectbox-windows:$objectboxVersion"
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlin:kotlin-reflect")
compile('org.json:json:20180813')
compile('com.google.code.gson:gson:2.8.5')
compile('javax.xml.bind:jaxb-api:2.2.8')
compile('io.springfox:springfox-swagger2:2.9.2')
compile('io.springfox:springfox-swagger-ui:2.9.2')
compile('org.antlr:antlr-complete:3.5.2')
}
// enable debug output for plugin
objectbox {
debug = true
}
// enable debug output for annotation processor
tasks.withType(JavaCompile) {
options.compilerArgs += ["-Aobjectbox.debug=true"]
}
GitHub链接:https ://github.com/objectbox/objectbox-java/issues/170#issuecomment-444075662