export COBDIR=/opt/microfocus/VisualCOBOL/bin/cobsetenv export COBOL_VERSION=<product-version>
where <product-version> is the version of your current product; for example: 8.0.0, 9.0.0, etc...
mvn install:install-file -Dfile="$COBDIR/lib/mfant.jar" -DgroupId=com.microfocus.cobol.build -DartifactId=mfant -Dversion=$COBOL_VERSION -Dpackaging=jar
mvn install:install-file -Dfile="$COBDIR/lib/mfunit.jar" -DgroupId=com.microfocus.cobol.rts -DartifactId=mfunit -Dversion=$COBOL_VERSION -Dpackaging=jarAfter two successful builds, both .jar files are installed in your Maven repository ( /home/user-name/.m2, by default).
The Create New File dialog box is displayed.
The file is opened in the editor.
<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>cobmfurun64</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.so</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>
Property | Description |
---|---|
<test.project.output.dir> | The output directory for your unit testing project. |
<test.project.output.artifact> | The name of the output file. |
<project.under.test.output.dir> | The output directory of the project under test. |
<test.results.dir> | The directory in which to output the test results. This is relative to the project directory. |
<test.results.junit.package> | The package name for the test results. |
<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>
A build is invoked and the results of the build are shown in <project.output.dir>.
If you are running Maven test, ensure that the project under test has already been built using Maven. On completion of the test run, the location specified in <test.results.dir> contains the result of the tests.