4 回答

TA贡献1802条经验 获得超10个赞
也许这会有所帮助
<dependency>
<artifactId>com.google</artifactId>
<groupId>Ab</groupId>
<version>0.0.4.3</version>
<scope>system</scope>
<systemPath>${basedir}/lib/Ab.jar</systemPath>
</dependency>
这样你就可以添加任何 jar 文件作为 Maven 依赖项。

TA贡献1810条经验 获得超5个赞
使用以下命令安装外部 jar
mvn install:install-file
然后将其作为 Maven 依赖项提供
<dependency>
<artifactId>your-custom-jar</artifactId>
<groupId>group.id</groupId>
<version>0.0.1</version>
</dependency>
spring 会将其打包到最终的可执行 jar 中

TA贡献1811条经验 获得超4个赞
您需要创建 Fat Jar / Uber Jar / Shadow Jar/ Shaded Jar(无论您喜欢哪个名称),以便所有依赖项都包含在 jar 文件中。
摇篮
使用插件 DSL:
plugins {
id "com.github.johnrengelman.shadow" version "5.1.0"
}
使用遗留插件应用程序:
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.github.jengelman.gradle.plugins:shadow:5.1.0"
}
}
apply plugin: "com.github.johnrengelman.shadow"
梅文
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.0.1.RELEASE</version>
</plugin>
</plugins>

TA贡献1836条经验 获得超4个赞
我必须在 pom 文件中进行更改。这将解决我的问题。
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>
</build>
我只需添加这一行,然后我的可执行 jar 文件就可以正常工作。
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
添加回答
举报