Spring Boot Gradle 添加 Native 库失败(java.lang.UnsatisfiedLinkError)

标签 spring gradle java-native-interface spring-boot jvm-arguments

我正在尝试将 native 库(.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属性
添加 gradle 系统属性(无法成功添加该参数)

最佳答案

我不明白为什么,但是当我按照以下步骤操作时,它起作用了:
1.我改了java包名
2.用gradle重建项目
3.运行项目

关于Spring Boot Gradle 添加 Native 库失败(java.lang.UnsatisfiedLinkError),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32138618/

相关文章:

java - 应该填充的集合为空

jenkins - 从Jenkins将多个Gradle Artifactory 上传到Artifactory

android - 无法解决:com.github.manuelpeinado.fadingactionbar:fadingactionbar-abc:3.1.2

c++ - NDK : has not been declared

android - 如何解决 Late-enabling CheckJNI?

java - Spring Stomp Websocket - 发送消息太大会产生 1009 错误并断开连接

Java Spring——在编译时识别语法错误(在 Eclipse 中)

android - 在项目上找不到属性 'uninstallDebug'

android - 在应用程序中使用外部静态库 (NDK)

java - 用户登录时 Shiro 过滤器验证用户错误