使用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

 

posted @ 2016-05-25 16:10  云中飞鱼  阅读(232)  评论(0编辑  收藏  举报