You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.8 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

### $docker$部署可执行$jar$包
> https://blog.csdn.net/leftfist/article/details/123510744
#### $java$替换$jar$中的$class$文件
> https://blog.csdn.net/whandgdh/article/details/136235995
在Maven项目中`pom.xml` 文件中的 `<packaging>` 标签定义了项目的打包方式。如果没有显式地指定 `<packaging>` 标签Maven 默认会使用 `jar` 作为打包方式,生成 `.jar` 文件。这意味着即使 `<packaging>` 标签不存在,项目仍然会生成一个 `.jar` 文件,而不是 `.class` 文件。
`.class` 文件是Java源代码编译后生成的字节码文件它们通常不会直接被 Maven 打包。Maven 会将这些 `.class` 文件包含在最终的 `.jar` 文件中。
如果你需要生成 `war` 文件比如对于Web应用程序你需要在 `pom.xml` 中添加 `<packaging>` 标签,并将其值设置为 `war`,如下所示:
```xml
<project>
...
<packaging>war</packaging>
...
</project>
```
这样Maven 就会生成一个 `war` 文件,而不是 `jar` 文件。如果你的项目不需要特定的打包方式,或者你只需要 `.class` 文件,你可以使用 Maven 的 `mvn compile` 命令来编译源代码,但不生成任何打包文件。如果你需要将 `.class` 文件打包到一个 `.jar` 文件中,可以使用 `mvn package` 命令。
# IDEA中使用Maven打包及碰到的问题
https://blog.csdn.net/tdcqfyl/article/details/140118134
![](https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/BlogImages/202407311456098.png)
![](https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/BlogImages/202407311456964.png)
# Java-maven打包报错:Failed to execute goal org.apache.maven.plugins:***There are test failures.
https://blog.csdn.net/weixin_43834477/article/details/139995920