Skip to content

NullPointerException during create-runtime-image #216

@ekpeters

Description

@ekpeters

NullPointerException experienced if the project artifact has not been created yet.

If you...

  • Skip the jar plugin (because the jar has been packed into a separate project)
  • create the image prior to assembling the jar (because it's being packed into the jar)
  • or other nonsense where the project lacks an artifact when moditect is invoked
    ...the build will fail on a NullPointerException.
    Works fine in release 1.0.0.RC1

Caused by: java.lang.NullPointerException
at org.moditect.mavenplugin.image.CreateRuntimeImageMojo.execute (CreateRuntimeImageMojo.java:126)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:370)
...

example pom:

<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>exmaple-sscce</groupId>
    <artifactId>moditect-image-npe-sscce</artifactId>
    <version>1.0.0</version>

    <build>
        <plugins>
            <plugin>
                <groupId>org.moditect</groupId>
                <artifactId>moditect-maven-plugin</artifactId>
                <version>1.0.0.Final</version>
                <executions>
                    <execution>
                        <id>generate-image</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>create-runtime-image</goal>
                        </goals>
                        <configuration>
                                <modulePath>
                                        <path>${project.build.directory}/modules</path>
                                </modulePath>
                                <modules>
                                <module>jdk.httpserver</module>
                                </modules>
                                <outputDirectory>
                                        ${project.build.directory}/jlink-image/slim-jre
                                </outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

Metadata

Metadata

Assignees

No one assigned

    Labels

    releasedIssue has been released

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions