3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Cobertura & Java 7 support

Last updated at Posted at 2013-02-17

#CoberturaをJava7で利用する方法
以下の対応をしないと、コンパイルエラーが発生する。

Java起動時にオプション指定を追加する
-XX:-UseSplitVerifier

##AntのBuild.xmlに追加する
<jvmarg value="-XX:-UseSplitVerifier" />

Build.xml
<!-- ユニットテストの実行 -->
<property name="report.junit.dir" location="${report.dir}/junit" />
<target name="test" depends="instrument" description="ユニットテストの実行">
	<mkdir dir="${report.junit.dir}" />
	<junit fork="yes" printsummary="yes" haltonfailure="no">
		<jvmarg value="-XX:-UseSplitVerifier" /> 
		<sysproperty key="net.sourceforge.cobertura.datafile" file="cobertura.ser" />
		<classpath>
			<pathelement location="${convert.dir}" />
			<pathelement location="${java.class.dir}" />
			<pathelement location="${test.class.dir}" />
			<fileset dir="${lib.servlet.dir}">
				<include name="*.jar" />
			</fileset>
			<fileset dir="${lib.junit.dir}">
				<include name="*.jar" />
			</fileset>
			<fileset dir="${lib.mock.dir}">
				<include name="*.jar" />
			</fileset>
			<path refid="cobertura.lib" />
		</classpath>
		<formatter type="xml" />
		<batchtest fork="yes" todir="${report.junit.dir}">
			<fileset dir="${test.src.dir}">
				<include name="**/*Test.java" />
			</fileset>
		</batchtest>
	</junit>
</target>

##mavenのpom.xml に追加する
<argLine>-XX:-UseSplitVerifier</argLine>

pom.xml
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.12</version>
    <configuration>
        <argLine>-XX:-UseSplitVerifier</argLine>
    </configuration>
</plugin>

出典:Jenkins実践入門

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?