一、第一次需要在IntelliJ IDEA中打包Maven项目,弄了半天,才搞好,记录一下。
二、打包步骤
1. 在IntelliJ IDEA主界面的右侧点击Maven Project:
2. 在打开的页面中点击lifecycle:
3. 然后双击package:
4. 然后看控制台的输出,成功的话会有BUILD SUCCESS字样出现的,否则就是有问题打包失败。
"C:\Program Files\Java\jdk1.8.0_231\bin\java.exe" -Dmaven
.multiModuleProjectDirectory
=F
:\WorkSpace\workspaces
-ideaIU
-2018.2.3\data
-source
-Dmaven
.home
=F
:\IDE\ideaIU
-2020.2.win\plugins\maven\lib\maven3
-Dclassworlds
.conf
=F
:\IDE\ideaIU
-2020.2.win\plugins\maven\lib\maven3\bin\m2
.conf
-javaagent
:D
:\Java\ideaIU
-2018.2.3.win\lib\idea_rt
.jar
=53890:D
:\Java\ideaIU
-2018.2.3.win\bin
-Dfile
.encoding
=UTF
-8 -classpath F
:\IDE\ideaIU
-2020.2.win\plugins\maven\lib\maven3\boot\plexus
-classworlds
-2.6.0.jar
;F
:\IDE\ideaIU
-2020.2.win\plugins\maven\lib\maven3\boot\plexus
-classworlds
.license org
.codehaus
.classworlds
.Launcher
-Didea
.version
=2018.2.3 package
[INFO
] Scanning
for projects
...
[INFO
]
[INFO
] --------------------< com
.pccw
.data
.resource
:data
>---------------------
[INFO
] Building data
-resource resource
[INFO
] --------------------------------[ jar
]---------------------------------
[INFO
]
[INFO
] --- maven
-resources
-plugin
:3.1.0:resources
(default-resources
) @ data
---
[INFO
] Using
'UTF-8' encoding to copy filtered resources
.
[INFO
] Copying
4 resources
[INFO
] Copying
3 resources
[INFO
]
[INFO
] --- maven
-compiler
-plugin
:3.8.1:compile
(default-compile
) @ data
---
[INFO
] Changes detected
- recompiling the module
!
[INFO
] Compiling
30 source files to F
:\WorkSpace\workspaces
-ideaIU
-2018.2.3\data
-source\target\classes
[INFO
]
[INFO
] --- maven
-resources
-plugin
:3.1.0:testResources
(default-testResources
) @ data
---
[INFO
] Using
'UTF-8' encoding to copy filtered resources
.
[INFO
] skip non existing resourceDirectory F
:\WorkSpace\workspaces
-ideaIU
-2018.2.3\data
-source\src\test\resources
[INFO
]
[INFO
] --- maven
-compiler
-plugin
:3.8.1:testCompile
(default-testCompile
) @ data
---
[INFO
] No sources to compile
[INFO
]
[INFO
] --- maven
-surefire
-plugin
:2.22.2:test
(default-test
) @ data
---
[INFO
]
[INFO
] -------------------------------------------------------
[INFO
] T E S T S
[INFO
] -------------------------------------------------------
[INFO
]
[INFO
] Results
:
[INFO
]
[INFO
] Tests run
: 0, Failures
: 0, Errors
: 0, Skipped
: 0
[INFO
]
[INFO
]
[INFO
] --- maven
-jar
-plugin
:3.1.2:jar
(default-jar
) @ data
---
[INFO
] Building jar
: F
:\WorkSpace\workspaces
-ideaIU
-2018.2.3\data
-source\target\data
-resource
.jar
[INFO
]
[INFO
] --- spring
-boot
-maven
-plugin
:2.2.5.RELEASE
:repackage
(repackage
) @ data
---
[INFO
] Replacing main artifact with repackaged archive
[INFO
] ------------------------------------------------------------------------
[INFO
] BUILD SUCCESS
[INFO
] ------------------------------------------------------------------------
[INFO
] Total time
: 11.793 s
[INFO
] Finished at
: 2020-09-03T15
:54:35+08:00
[INFO
] ------------------------------------------------------------------------
Process finished with exit code
0
5. 打包后的jar包在跟目录的target文件夹里面
三、总结:如果有疑问可以直接留言评论,如果觉得对你有帮助,可以小小的赞赏一杯奶茶钱,谢谢!!