Skip to content

Instantly share code, notes, and snippets.

@repoplus
Last active June 8, 2016 01:22
Show Gist options
  • Save repoplus/fd013ef15782718586815c236153f684 to your computer and use it in GitHub Desktop.
Save repoplus/fd013ef15782718586815c236153f684 to your computer and use it in GitHub Desktop.
maven、设置编码、jdk版本、tomcat插件、设置端口号、访问url、jvm内存

设置项目编码和jdk版本

<plugins>
	<plugin>
		<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-compiler-plugin</artifactId>
		<version>3.1</version>
		<configuration>
			<source>1.7</source>
			<target>1.7</target>
			<encoding>UTF-8</encoding><!-- 指定编码格式,否则在DOS下运行mvn compile命令时会出现莫名的错误,因为系统默认使用GBK编码 -->
		</configuration>
	</plugin>
	<plugin>
		<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-resources-plugin</artifactId>
		<version>2.6</version>
		<configuration>
			<encoding>UTF-8</encoding><!-- 指定编码格式,否则在DOS下运行mvn命令时当发生文件资源copy时将使用系统默认使用GBK编码 -->
		</configuration>
	</plugin>
</plugins>

maven的tomcat插件、设置端口号、访问路径、和jvm内存

<plugin>
	<groupId>org.apache.tomcat.maven</groupId>
	<artifactId>tomcat7-maven-plugin</artifactId>
	<version>2.2</version>
	<configuration>
		<port>8882</port>
		<path>/</path>
		<uriEncoding>UTF-8</uriEncoding>
		<warSourceDirectory>${basedir}/src/main/webapp</warSourceDirectory>
		<systemProperties>
			<JAVA_OPTS>-Xms1024m -Xmx2048m -XX:PermSize=512m -XX:MaxPermSize=1024m -Dfile.encoding=UTF-8</JAVA_OPTS>
		</systemProperties>
	</configuration>
</plugin>
@repoplus
Copy link
Author

repoplus commented Jun 1, 2016

maven设置项目jdk和默认编码

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment