Skip to content

Confusing null reference exception when run in Maven without referenced base tree #14

@olafur-skulason

Description

@olafur-skulason

When building an Overture code generation project with AstCreator, using maven.

AstCreator prints out "Extension base artifact found - exstracting base tree definition files" indicating that the extension base artifact has been found and then if no such artifact is specified a null pointer exception is thrown.

The problem occurs in: maven/src/main/java/org/overture/tools/maven/astcreator/GenerateTree.java in line 80.

To cause the issue a maven pom.xml which defines the plugin in the build. As in the Overture/vdm2c project, but not including an artifact dependeny providing the artifact indicated in extendedAstArtifactId.

To solve the issue I would propose adding before line 79 of maven/src/main/java/org/overture/tools/maven/astcreator/GenerateTree.java with along the lines of:

if(baseArtifact == null)
{
getLog().error("Base artifact not found. Are you missing an artifact dependency?");
return;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions