IDEA利用maven生成javadoc,控制台中文乱码

目录

一、问题描述

二、问题解决


一、问题描述

使用maven的javadoc插件生成文档,在执行的过程中,控制台出现乱码:

java 复制代码
[INFO] --- maven-javadoc-plugin:3.1.1:jar (default) @ IJPay-AliPay ---
[INFO] 
���ڼ���Դ�ļ�E:\projects\IJPay-master\IJPay-AliPay\src\main\java\com\ijpay\alipay\AliPayApi.java...
���ڼ���Դ�ļ�E:\projects\IJPay-master\IJPay-AliPay\src\main\java\com\ijpay\alipay\AliPayApiConfig.java...
���ڼ���Դ�ļ�E:\projects\IJPay-master\IJPay-AliPay\src\main\java\com\ijpay\alipay\AliPayApiConfigKit.java...
���ڼ���Դ�ļ�E:\projects\IJPay-master\IJPay-AliPay\src\main\java\com\ijpay\alipay\AliPayCore.java...
���ڼ���Դ�ļ�E:\projects\IJPay-master\IJPay-AliPay\src\main\java\enums\SignType.java...
���ڹ��� Javadoc ��Ϣ...
��׼ Doclet �汾 1.8.0_271
���ڹ������г�����������...
��������E:\projects\IJPay-master\IJPay-AliPay\target\apidocs\enums\SignType.html...
��������E:\projects\IJPay-master\IJPay-AliPay\target\apidocs\com\ijpay\alipay\AliPayApi.html...
��������E:\projects\IJPay-master\IJPay-AliPay\target\apidocs\com\ijpay\alipay\AliPayApiConfig.html...
��������E:\projects\IJPay-master\IJPay-AliPay\target\apidocs\com\ijpay\alipay\AliPayApiConfigKit.html...
��������E:\projects\IJPay-master\IJPay-AliPay\target\apidocs\com\ijpay\alipay\AliPayCore.html...
��������E:\projects\IJPay-master\IJPay-AliPay\target\apidocs\overview-frame.html...
��������E:\projects\IJPay-master\IJPay-AliPay\target\apidocs\com\ijpay\alipay\package-frame.html...
��������E:\projects\IJPay-master\IJPay-AliPay\target\apidocs\com\ijpay\alipay\package-summary.html...
��������E:\projects\IJPay-master\IJPay-AliPay\target\apidocs\com\ijpay\alipay\package-tree.html...
��������E:\projects\IJPay-master\IJPay-AliPay\target\apidocs\enums\package-frame.html...
��������E:\projects\IJPay-master\IJPay-AliPay\target\apidocs\enums\package-summary.html...
��������E:\projects\IJPay-master\IJPay-AliPay\target\apidocs\enums\package-tree.html...
��������E:\projects\IJPay-master\IJPay-AliPay\target\apidocs\constant-values.html...
��������E:\projects\IJPay-master\IJPay-AliPay\target\apidocs\serialized-form.html...
��������E:\projects\IJPay-master\IJPay-AliPay\target\apidocs\com\ijpay\alipay\class-use\AliPayApi.html...
��������E:\projects\IJPay-master\IJPay-AliPay\target\apidocs\com\ijpay\alipay\class-use\AliPayApiConfig.html...
��������E:\projects\IJPay-master\IJPay-AliPay\target\apidocs\com\ijpay\alipay\class-use\AliPayApiConfigKit.html...
��������E:\projects\IJPay-master\IJPay-AliPay\target\apidocs\com\ijpay\alipay\class-use\AliPayCore.html...
��������E:\projects\IJPay-master\IJPay-AliPay\target\apidocs\enums\class-use\SignType.html...
��������E:\projects\IJPay-master\IJPay-AliPay\target\apidocs\com\ijpay\alipay\package-use.html...
��������E:\projects\IJPay-master\IJPay-AliPay\target\apidocs\enums\package-use.html...
���ڹ������г�������������...
��������E:\projects\IJPay-master\IJPay-AliPay\target\apidocs\overview-tree.html...
��������E:\projects\IJPay-master\IJPay-AliPay\target\apidocs\index-all.html...
��������E:\projects\IJPay-master\IJPay-AliPay\target\apidocs\deprecated-list.html...
���ڹ��������������...
��������E:\projects\IJPay-master\IJPay-AliPay\target\apidocs\allclasses-frame.html...
��������E:\projects\IJPay-master\IJPay-AliPay\target\apidocs\allclasses-noframe.html...
��������E:\projects\IJPay-master\IJPay-AliPay\target\apidocs\index.html...
��������E:\projects\IJPay-master\IJPay-AliPay\target\apidocs\overview-summary.html...
��������E:\projects\IJPay-master\IJPay-AliPay\target\apidocs\help-doc.html...
3 ������
[WARNING] Javadoc Warnings
[WARNING] E:\projects\IJPay-master\IJPay-AliPay\src\main\java\com\ijpay\alipay\AliPayApi.java:835: ����: appAuthTokenû�� @param
[WARNING] public static AlipayTradePrecreateResponse tradePrecreatePayToResponse(AlipayClient alipayClient, Boolean certModel, AlipayTradePrecreateModel model, String notifyUrl, String appAuthToken) throws AlipayApiException {
[WARNING] ^
[WARNING] E:\projects\IJPay-master\IJPay-AliPay\src\main\java\com\ijpay\alipay\AliPayCore.java:36: ����: com.alipay.api.AlipayApiExceptionû�� @throws
[WARNING] public static String buildRequestMySign(Map<String, String> params, String key, String signType) throws AlipayApiException {
[WARNING] ^
[WARNING] E:\projects\IJPay-master\IJPay-AliPay\src\main\java\com\ijpay\alipay\AliPayCore.java:127: ����: @throws û��˵��
[WARNING] * @throws AlipayApiException
[WARNING] ^

刚开始在pom文件中没有添加configuration指定编码,添加编码后,重新执行,还是乱码,错误依旧

XML 复制代码
<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-javadoc-plugin</artifactId>
	<version>3.1.1</version>
	<configuration>
		<charset>UTF-8</charset><!-- utf-8读取文件 -->
		<encoding>UTF-8</encoding><!-- utf-8进行编码代码 -->
		<docencoding>UTF-8</docencoding><!-- utf-8进行编码文档 -->
	</configuration>
	<executions>
		<execution>
			<phase>package</phase>
			<goals>
				<goal>jar</goal>
			</goals>
		</execution>
	</executions>
</plugin>

二、问题解决

需要IDEA中进行配置,打开File | Settings | Build, Execution, Deployment | Build Tools | Maven | Runner在VM Options中添加**-Dfile.encoding=GBK**,切记一定是GBK。如果使用UTF-8的话,依然是乱码,这是因为Maven的默认平台编码是GBK。添加后重新执行,正常显示

相关推荐
L.S.V.31 分钟前
Java 溯本求源之基础(三十)——封装,继承与多态
java·开发语言
码农爱java32 分钟前
设计模式--装饰器模式【结构型模式】
java·设计模式·面试·装饰器模式·原理·23 中设计模式
星就前端叭1 小时前
【开源】一款基于SpringBoot的智慧小区物业管理系统
java·前端·spring boot·后端·开源
带刺的坐椅1 小时前
RxSqlUtils(base R2dbc)
java·reactor·solon·r2dbc
silence2501 小时前
深入了解 Reactor:响应式编程的利器
java·spring
weixin_SAG2 小时前
21天掌握javaweb-->第19天:Spring Boot后端优化与部署
java·spring boot·后端
m0_748247552 小时前
SpringMVC跨域问题解决方案
java
Elcker2 小时前
KOI技术-事件驱动编程(Sping后端)
java·spring·架构
GitNohup2 小时前
Spring boot处理跨域问题
java·spring boot·跨域
Just_Paranoid2 小时前
使用 IDE生成 Java Doc
java·开发语言·ide