-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
Bence Sipka opened MNG-6932 and commented
When the maven-resolver and related classes are used with a ClassLoader
that doesn't define a java.lang.Package object for the loaded classes, the library throws a NullPointerException
.
Scenario: I'm using the maven-resolver classes to resolver artifacts from various repositories. I package the app, and deploy it to a custom environment where the ClassLoader
for the app doesn't define a Package
for the loaded classes. In these cases, when the maven-resolver library calls this.getClass().getPackage().getImplementationVersion()
then a NullPointerException
will occurr.
The following classes are affected:
DefaultSuperPomProvider.getSuperModel():81
DefaultReportingConverter.<init>:56
Code around the locations:
String modelId = "org.apache.maven:maven-model-builder:"
+ this.getClass().getPackage().getImplementationVersion() + ":super-pom";
InputSource inputSource = new InputSource();
inputSource.setModelId( modelId );
This exception makes the library unportable to different environments.
Workaround:
Implement a custom variant of the above classes that circumvent these parts of the code.
Possible solution:
Null checks, and hard coding the version number.
Affects: 3.6.3
Issue Links:
- MNG-6593 track input location for super-pom
("is caused by") - MNG-6600 add input location tracking for default lifecycle bindings executions
("is caused by") - MNG-6960 Use RuntimeInformation instead of reading properties
("depends upon")
0 votes, 5 watchers