jsonschema-generator icon indicating copy to clipboard operation
jsonschema-generator copied to clipboard

Classpath of the maven plugin is not properly set

Open JanLabrie opened this issue 6 years ago • 2 comments

Testing the Maven plugin with the unit tests works fine. But...testing it in my real-live project revealed that the removal of the explicit classpath setting and usage of the @requiresDependencyResolution annotation is not good enough.

Error loading class ... is the consequence.

When you read the quote from The Maven Guide

Please note that the plugin classloader does neither contain the dependencies of the current project nor its build output. Instead, plugins can query the project's compile, runtime and test class path from the MavenProject in combination with the mojo annotation requiresDependencyResolution from the Mojo API Specification. For instance, flagging a mojo with @requiresDependencyResolution runtime enables it to query the runtime class path of the current project from which it could create further classloaders.

you see that the requiresDependencyResolution does not add the dependencies to the classpath. This is what you need to do yourself.

I will create a branch to fix this.

JanLabrie avatar Apr 30 '20 09:04 JanLabrie

PR has been created.

JanLabrie avatar Apr 30 '20 15:04 JanLabrie

Released as v4.11.1.

CarstenEnglert avatar Apr 30 '20 19:04 CarstenEnglert