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。添加后重新执行,正常显示

相关推荐
代码之光_198016 分钟前
保障性住房管理:SpringBoot技术优势分析
java·spring boot·后端
ajsbxi22 分钟前
苍穹外卖学习记录
java·笔记·后端·学习·nginx·spring·servlet
StayInLove40 分钟前
G1垃圾回收器日志详解
java·开发语言
对许44 分钟前
SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder“
java·log4j
无尽的大道1 小时前
Java字符串深度解析:String的实现、常量池与性能优化
java·开发语言·性能优化
小鑫记得努力1 小时前
Java类和对象(下篇)
java
binishuaio1 小时前
Java 第11天 (git版本控制器基础用法)
java·开发语言·git
zz.YE1 小时前
【Java SE】StringBuffer
java·开发语言
老友@1 小时前
aspose如何获取PPT放映页“切换”的“持续时间”值
java·powerpoint·aspose
wrx繁星点点1 小时前
状态模式(State Pattern)详解
java·开发语言·ui·设计模式·状态模式