1 .JDK版本 问题,有的泛型之类需要JDK5.0,在pom.xml中添加插件
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<!--maven默认值为 1.3-->
<source>1.5</source>
<target>1.5</target>
<!-- ***********在win xp中不管 cmd下,还是eclipse IDE中, java编译的文件还是乱码。
complier使用系统默认的GBK编码.************-->
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</build>
2,Maven中解决资源文件中文乱码问题
Maven给出这样的提示:[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
由于我们使用的Windows默认是GBK编码的,那用GBK的编码重新读写UTF-8的文件,那肯定是会出现乱码的。
Xml代码
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <configuration>
- <encoding>UTF-8</encoding>
- </configuration>
- </plugin>
3,Maven单元测试
必须指定test目录
Xml代码
- <testSourceDirectory>${basedir}/test</testSourceDirectory>
测试类以Test开头或者结尾命名