set COBDIR=C:\Program Files (x86)\Micro Focus\Enterprise Developer
set COBOL_VERSION=8.0.0
mvn install:install-file -Dfile="%COBDIR%\bin\mfant.jar" -DgroupId=com.microfocus.cobol.build -DartifactId=mfant -Dversion=%COBOL_VERSION% -Dpackaging=jar
mvn install:install-file -Dfile="%COBDIR%\bin\mfunit.jar" -DgroupId=com.microfocus.cobol.rts -DartifactId=mfunit -Dversion=%COBOL_VERSION% -Dpackaging=jar両方のビルドが成功すると、2 つの .jar ファイルが Maven リポジトリ (デフォルトでは %USERPROFILE%\.m2) にインストールされます。
[Create New File] ダイアログ ボックスが表示されます。
ファイルがエディターで開きます。
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.mfcobolbook.cobol</groupId> <artifactId>MyMavenUnitTestProject</artifactId> <version>1.0.0</version> <build> </build> </project>
<properties>
<mfurun.executable>mfurun</mfurun.executable>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<test.project.output.dir>${project.basedir}/New_Configuration.bin</test.project.output.dir>
<test.project.output.artifact>MyMavenUnitTestProject.dll</test.project.output.artifact>
<project.under.test.output.dir>${project.basedir}/../MyMavenProject/New_Configuration.bin</project.under.test.output.dir>
<test.results.dir>test-results</test.results.dir>
<test.results.junit.package>native.MyTestResults.testcases</test.results.junit.package>
</properties>
| プロパティ | 説明 |
|---|---|
| <test.project.output.dir> | 単体テスト プロジェクトの出力ディレクトリ。 |
| <test.project.output.artifact> | 出力ファイルの名前。 |
| <project.under.test.output.dir> | テスト対象のプロジェクトの出力ディレクトリ。 |
| <test.results.dir> | テスト結果を出力するディレクトリ。これは、プロジェクト ディレクトリを基準とする相対パスです。 |
| <test.results.junit.package> | テスト結果のパッケージの名前。 |
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>build</id>
<phase>compile</phase>
<configuration>
<target>
<ant antfile="${project.basedir}/.cobolBuild" target="cobolbuild" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<id>test</id>
<phase>test</phase>
<configuration>
<target>
<!-- Generate an mfu file -->
<exec dir="${test.project.output.dir}" executable="${mfurun.executable}">
<arg value="-generate-mfu ${test.project.output.artifact}"/>
</exec>
<!-- Run the tests -->
<taskdef name="mfurun" classname="com.microfocus.mfunit.ant.MFURunMFUTask"/>
<mfurun printsummary="true" junitresults="true" junitreportpackage="${test.results.junit.package}" outputdir="${test.results.dir}">
<fileset dir="${test.project.output.dir}" includes="*.mfu" />
<env key="COBPATH" value="${project.under.test.output.dir}" />
</mfurun>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<id>clean</id>
<phase>clean</phase>
<configuration>
<target>
<ant antfile="${project.basedir}/.cobolBuild" target="clean" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b3</version>
<exclusions>
<exclusion>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.microfocus.cobol.build</groupId>
<artifactId>mfant</artifactId>
<version>8.0.0</version>
</dependency>
<dependency>
<groupId>com.microfocus.cobol.rts</groupId>
<artifactId>mfunit</artifactId>
<version>8.0.0</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
[Maven test] を実行する場合は、テスト対象のプロジェクトがすでに Maven を使用してビルドされていることを確認してください。テストの実行が完了すると、<test.results.dir> で指定された場所にテストの結果が格納されます。