我们使用第三方jar,它本质上是两个动态链接库(.so)提供的方法定义的入口点。我们希望将它们包含在maven构建中。第三方jar很简单,但我们如何包含库,因为没有它们我们在运行时会遇到链接器错误?
sqlrelay是第三方依赖项,它使用以下命令安装:
mvn install:install-file -Dfile=sqlrelay.jar -DgroupId=com.firstworks -DartifactId=sqlrelay -Dpackaging=jar -Dversion=1.2.1
运行时错误是:
java.lang.UnsatisfiedLinkError no SQLRConnection in java.library.path
这是一个Spring Boot应用程序,这是我的pom:
http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0
<groupId>org.springframework</groupId> <artifactId>gs-rest-service</artifactId> <version>0.1.0</version> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.9.RELEASE</version> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>com.jayway.jsonpath</groupId> <artifactId>json-path</artifactId> <scope>test</scope> </dependency> <!-- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-s3 --> <dependency> <groupId>com.amazonaws</groupId> <artifactId>aws-java-sdk-s3</artifactId> <version>1.11.248</version> </dependency> <dependency> <groupId>com.firstworks</groupId> <artifactId>sqlrelay</artifactId> > <version>1.2.1</version> </dependency> <dependency> <groupId>com.bettercloud</groupId> <artifactId>vault-java-driver</artifactId> <version>3.0.0</version> </dependency> </dependencies> <properties> <java.version>1.8</java.version> </properties> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> <repositories> <repository> <id>spring-releases</id> <url>https://repo.spring.io/libs-release</url> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>spring-releases</id> <url>https://repo.spring.io/libs-release</url> </pluginRepository> </pluginRepositories> </project>
mvn clean install
构建没有错误,应用程序运行。只有在端点引用相关库时才会触及该问题。
由于
取值