`

Hudson通过Maven自动构建中文乱码

 
阅读更多

Maven中的中文编码问题

在Windows下,默认编码是GBK,所以需要在pom中增加属性:

 

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>

 

 

第一个在filter拷贝文件时用,第二个在编译时用。第二个属性是在 http://maven.apache.org/plugins/maven-compiler-plugin/ 翻到的

 

 

 

 

在项目的footer.vm文件中使用了hudson的环境变量,所以需要进行filter

 

<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<configuration>
					<webResources>
						<resource>
							<filtering>true</filtering>
							<directory>src/main/webapp</directory>
							<includes>
								<include>**/footer.vm</include>
							</includes>
						</resource>
					</webResources>
				</configuration>
			</plugin>

 但是footer.vm文件中有中文,在linux中hudson自动build时出现了乱码的情况,按照如上的情况可以解决

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics