目录
一、问题描述
使用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。添加后重新执行,正常显示