Spring 启动 Gradle 添加本机库失败 (java.lang.UnsatisfiedLinkError)
Spring Boot Gradle add Native library failed (java.lang.UnsatisfiedLinkError)
我正在尝试将本机库(.dll
文件)添加到基本 spring gradle 项目。
我尝试了许多不同的设置,但所有设置都无法在基本的 java 项目中工作,我通过添加 VM 参数成功 运行 该 dll 文件:java.library.path gradle
这是脚本:
buildscript {
ext {
springBootVersion = '1.2.5.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
jar {
baseName = 'messaging'
version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-aop")
compile("org.springframework.boot:spring-boot-starter-amqp")
compile("org.springframework:spring-messaging")
compile('javax.inject:javax.inject:1')
compile('com.google.guava:guava:11.0.2')
compile('org.codehaus.jackson:jackson-core-asl:1.1.0')
compile('org.codehaus.jackson:jackson-mapper-asl:1.9.13')
testCompile("org.springframework.boot:spring-boot-starter-test")
}
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
我试过:
在 eclipse 上添加 VM 参数
添加 jvm 属性
add gradle system 属性 (无法成功添加该参数)
我不明白为什么,但是当我按照以下步骤操作时,它起作用了:
1.我更改了java包名
2. 用 gradle 重建项目
3.运行项目
我正在尝试将本机库(.dll
文件)添加到基本 spring gradle 项目。
我尝试了许多不同的设置,但所有设置都无法在基本的 java 项目中工作,我通过添加 VM 参数成功 运行 该 dll 文件:java.library.path gradle
这是脚本:
buildscript {
ext {
springBootVersion = '1.2.5.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
jar {
baseName = 'messaging'
version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-aop")
compile("org.springframework.boot:spring-boot-starter-amqp")
compile("org.springframework:spring-messaging")
compile('javax.inject:javax.inject:1')
compile('com.google.guava:guava:11.0.2')
compile('org.codehaus.jackson:jackson-core-asl:1.1.0')
compile('org.codehaus.jackson:jackson-mapper-asl:1.9.13')
testCompile("org.springframework.boot:spring-boot-starter-test")
}
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
我试过:
在 eclipse 上添加 VM 参数 添加 jvm 属性 add gradle system 属性 (无法成功添加该参数)
我不明白为什么,但是当我按照以下步骤操作时,它起作用了: 1.我更改了java包名 2. 用 gradle 重建项目 3.运行项目