ITeye博客

Maven compile plugin

bruce008 · 2012-09-18 17:38 · J2SE · 编程语言 · Markdown

我们的项目基本都是用Maven 来作为 build 工具, 在pom 中配置一个 maven-compiler-plugin。  大多数情况下我们只需要指定下 jdk 的版本的就好:

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>2.3.2</version>
				<configuration>
					<source>${jdk.version}</source>
					<target>${jdk.version}</target>
					<encoding>${project.build.sourceEncoding}</encoding>
					<compilerArguments>
						<verbose />
						<bootclasspath>${java.home}/lib/rt.jar</bootclasspath>
					</compilerArguments>
				</configuration>
			</plugin>

 

 

这个maven-compiler-plugin 其实是有很多的属性对应着 javac相应的属性。  比如 在javac 时, 我们可以指定 debug 以及debugLevel.  这个plugin 也是支持的, 默认情况下debug 是默认true, 这个 debugLevel 只有在debug 为true 的时候才有效的。  它对应做 javac 的 -g 的值。   默认情况下 我们不需要指定这两个东东的。 如果指定通常是我们想关掉debug的信息的, 这个时候我们可以这样做的, 加两个属性:

 

                     <debug>true</debug>
                    <debuglevel>none</debuglevel>

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。