mvn spring-boot: 中文控制台乱码

版权声明:转载注明来源 https://blog.csdn.net/love_moon821/article/details/83619625

mvn打包后的 jar 运行的 bat 文件中:

java -jar xxxxxxx.jar

解决方法:

java -Dfile.encoding=utf-8 -jar xxxxxxx.jar

不可行的话继续参看下面:

在pom.xml配置文件加入jvm启动参数:

<jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>

详细配置如下:

<build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
                </configuration>
          
 </plugin>
        </plugins>
    </build>

打包后的jar, 运行时去掉: -Dfile.encoding=utf-8

OK,完美解决....

扫描二维码关注公众号,回复: 5711925 查看本文章

猜你喜欢

转载自blog.csdn.net/love_moon821/article/details/83619625
mvn
今日推荐