mirror of https://github.com/apache/maven.git
[MNG-7759] Maven2 plugins will not have even session setter (#1084)
As setter was added in Maven3. Still, this causes unexpected NPE during plugin execution, while Maven3 should support Maven2 plugins. --- https://issues.apache.org/jira/browse/MNG-7759
This commit is contained in:
parent
bc138dc3ba
commit
eb7cdefaaa
|
@ -1000,6 +1000,10 @@ public class DefaultProjectBuilder implements ProjectBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
private ModelCache createModelCache(RepositorySystemSession session) {
|
private ModelCache createModelCache(RepositorySystemSession session) {
|
||||||
|
// MNG-7759: very old clients (Maven2 plugins) will not even have session, as setter was added in Maven 3
|
||||||
|
if (session == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
// MNG-7693: for older clients (not injecting ModelCacheFactory), make this work OOTB w/ defaults
|
// MNG-7693: for older clients (not injecting ModelCacheFactory), make this work OOTB w/ defaults
|
||||||
return modelCacheFactory != null
|
return modelCacheFactory != null
|
||||||
? modelCacheFactory.createCache(session)
|
? modelCacheFactory.createCache(session)
|
||||||
|
|
Loading…
Reference in New Issue