我创建了Java Spring Boot REST API。我可以从 Springtoolsuit4 开始运行Spring Boot API,并且可以连接返回JSON值的本地主机。
在此API中,我使用了放置在其中的外部jar文件,并从该jar文件创建实例,然后运行终端mvn package
。显示:
但是我现在可以从Springtoolsuit运行,我想部署到服务器;这就是为什么我需要构建可执行的jar文件
问题是外部jar文件类无法构建
import com.dbs.sgqr.generator.QRGenerator;
import com.dbs.sgqr.generator.QRGeneratorImpl;
import com.dbs.sgqr.generator.io.PayNow;
import com.dbs.sgqr.generator.io.QRDimensions;
import com.dbs.sgqr.generator.io.QRGeneratorResponse;
import com.dbs.sgqr.generator.io.QRType;
我的pom文件是:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.propnex</groupId>
<artifactId>DbsQr</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>DbsQr</name>
<description>Project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<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.dbs.sgqr.generator</groupId>
<artifactId>SGQRGeneratorV1.5</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/SGQRGeneratorV1.5.jar</systemPath>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>