使用IDEA打jar包的详细图文教程

1. 点击intellij idea左上角的"File"菜单 -> Project Structure

2. 点击"Artifacts" -> 绿色的"+" -> "JAR" -> Empty

3. Name栏填入自定义的名字,Output ditectory 选择 jar 包目标目录,Available Elements 里右击需要添加到 jar 包的文件,即可添加到左边的jar 包目录下,具体看下图。

!!!注意这里:需要将依赖也加入到左边,不然生成的 jar 包,启动时会报错。

选中所有依赖,右击【Put into Output Root】。

4.以上设置完之后, 点击应用,确定

或者使用下面这种方式:

6. 点击菜单中"Build" -> "Build Artifacts"。

7. 双击弹出框中待生成jar包下面的build即可,如下图

第二种打包方式(使用Maven的Packge打包)

在父 pom.xml 中就,加入如下配置:

复制代码
<build>
       <!-- 最终打包的名字 -->
       <finalName>springboot</finalName>

       <!--  手动指定文件夹为resources,加载java下所有的xml文件-->
       <resources>
           <resource>
               <directory>src/main/java</directory>
               <includes>
                   <include>**/*.xml</include>
               </includes>
           </resource>
           <resource>
               <directory>src/main/resources</directory>
               <includes>
                   <include>**/*.*</include>
               </includes>
           </resource>
       </resources>

       <plugins>
           <plugin>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-maven-plugin</artifactId>
               <configuration>
                   <includeSystemScope>true</includeSystemScope>
               </configuration>
           </plugin>
       </plugins>
</build>

点击 IDEA 右侧的 Maven 点击 package 即可打包完成!

相关推荐
jason_renyu6 小时前
Playwright 入门与实操:从安装、定位、断言到自动发博客,把浏览器自动化讲明白
运维·python·自动化·前端开发·浏览器自动化·playwright·e2e测试
维克兜率天6 小时前
【维克】布林带:通道类指标的“量化基石“
人工智能·python·算法
向科→向总工→空间动态计系统7 小时前
机器人大脑系统
开发语言·人工智能·python·机器人
染指11107 小时前
194.DeepAgents-在DeepAgents中使用自定义沙盒环境OpenSandBox
网络·人工智能·python·langchain·deepagents
m0_646429978 小时前
LangGraph 学习笔记(一):StateGraph 与状态管理
python·langgraph
Dmz丶8 小时前
前端转 AI 100 天 Day 57:RAG 项目实战(六)——上线后迭代,从“能用”到“越用越好”
python
小小-猿9 小时前
用 Python 写昇腾算子:pyasc 是怎么回事
开发语言·python·昇腾·cann·pyasc
蓝蓝的代码人9 小时前
用 Python、Qt 和 Vue 做一个 Windows 股票看盘工具,观潮的行情小窗与桌面提醒
vue.js·python·qt·开源·桌面应用
富贵儿99810 小时前
NL2SQL 实践手记 10:从命令行到网页查询——把整个系列串起来
数据库·python·sql·ai·自然语言处理·langchain
fengkai454510 小时前
Python对接LangChain智能体开发(Tool工具调用与 Agent智能体)
运维·开发语言·python·langchain·llm·ai agent·tool