使用maven打包的注意事项

maven编译项目的时候,默认使用的GBK,而目前大部分代码都使用的UTF-8的方式,所以这时候打出来的包容易出现乱码。

解决方式:

            <!-- compiler插件, 设定JDK版本 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <showWarnings>true</showWarnings>
                </configuration>
            </plugin>

 打包的bat文件

@echo off
echo [INFO] Install the jar to local

cd %~dp0
cd ..
call mvn clean install -Dmaven.test.skip=true
pause
原文地址:https://www.cnblogs.com/kzfy/p/5527412.html