Maven 生成(打包)带有依赖的可以直接执行的一个 jar 包

在pom中增加如下内容

复制代码
<build>
  <plugins>
    <plugin>
      <artifactId>maven-assembly-plugin</artifactId>
      <configuration>
        <archive>
          <manifest>
            <mainClass>com.example.xxx.YourClass</mainClass>
          </manifest>
        </archive>
        <descriptorRefs>
          <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
      </configuration>
    </plugin>
  </plugins>
</build>

运行打包命令:mvn clean compile assembly:single

相关推荐
韩立学长4 分钟前
【开题答辩实录分享】以《基于Python的大学超市仓储信息管理系统的设计与实现》为例进行选题答辩实录分享
开发语言·python
qq_192779876 分钟前
高级爬虫技巧:处理JavaScript渲染(Selenium)
jvm·数据库·python
u01092727125 分钟前
使用Plotly创建交互式图表
jvm·数据库·python
爱学习的阿磊26 分钟前
Python GUI开发:Tkinter入门教程
jvm·数据库·python
Imm7771 小时前
中国知名的车膜品牌推荐几家
人工智能·python
tudficdew1 小时前
实战:用Python分析某电商销售数据
jvm·数据库·python
sjjhd6522 小时前
Python日志记录(Logging)最佳实践
jvm·数据库·python
2301_821369612 小时前
用Python生成艺术:分形与算法绘图
jvm·数据库·python
机 _ 长2 小时前
YOLO26 改进 | 基于特征蒸馏 | 知识蒸馏 (Response & Feature-based Distillation)
python·深度学习·机器学习
2401_832131953 小时前
Python单元测试(unittest)实战指南
jvm·数据库·python