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

相关推荐
通往曙光的路上2 分钟前
陪玩小项目努力
java
w***4812 分钟前
Maven Spring框架依赖包
java·spring·maven
汤姆yu2 分钟前
基于springboot的乡村信息建设管理系统
java·spring boot·后端
Halo_tjn3 分钟前
Java List集合
java·windows·计算机
多敲代码防脱发5 分钟前
初识Spring-Cloud——集群与分布式
java·spring boot·spring
O***Z6166 分钟前
HeidiSQL导入与导出数据
java
毕设源码-朱学姐7 分钟前
【开题答辩全过程】以 老年公寓信息管理系统为例,包含答辩的问题和答案
java·spring boot
GoodStudyAndDayDayUp7 分钟前
WIN11安装配置验证java\maven
java·开发语言·maven
一 乐9 分钟前
游戏账号交易|基于Springboot+vue的游戏账号交易系统(源码+数据库+文档)
java·前端·数据库·vue.js·spring boot·后端·游戏
程序员-周李斌11 分钟前
LinkedList 源码深度分析(基于 JDK 8)
java·开发语言·数据结构·list