jdk9-jlink-jmod-example icon indicating copy to clipboard operation
jdk9-jlink-jmod-example copied to clipboard

Odd behaviour, jacoco is required execute jlink

Open vromero opened this issue 7 years ago • 1 comments

This is a very unexpected behaviour, I was trying to use your example without your parent and found out that if the jacoco plugin is not present, jlink doesn't work.

To reproduce:

git clone https://github.com/vromero/jlink-jacoco-build.git
cd jlink-jacoco-build
mvn clean package

Observe the following:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.412 s
[INFO] Finished at: 2017-12-12T11:37:49-08:00
[INFO] Final Memory: 20M/485M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jlink-plugin:3.0.0-alpha-1:jlink (default-jlink) on project mod-jlink: Execution default-jlink of goal org.apache.maven.plugins:maven-jlink-plugin:3.0.0-alpha-1:jlink failed.: NullPointerException -> [Help 1]
[ERROR] 

Then edit pom.xml and uncomment the following block:

           <!-- Uncomment the following plugin to fix the build -->
            <!--plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.7.9</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-agent</goal>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin-->

And observe:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.493 s
[INFO] Finished at: 2017-12-12T11:39:19-08:00
[INFO] Final Memory: 21M/390M
[INFO] ------------------------------------------------------------------------

vromero avatar Dec 12 '17 19:12 vromero