desruisseaux commented on PR #84:
URL: 
https://github.com/apache/maven-plugin-testing/pull/84#issuecomment-2726458358

   Note: with Maven 4.0.0-rc-3, the tests of the Maven compiler plugin fail 
with the following stack trace:
   
   ```
   java.lang.NullPointerException: Cannot invoke 
"org.apache.maven.api.services.Lookup.lookupOptional(java.lang.Class)" because 
the return value of "org.apache.maven.api.Session.getService(java.lang.Class)" 
is null
        at 
org.apache.maven.impl.DefaultToolchainManager.retrieveContext(DefaultToolchainManager.java:120)
        at 
org.apache.maven.impl.DefaultToolchainManager.getToolchainFromBuildContext(DefaultToolchainManager.java:90)
        at 
org.apache.maven.plugin.compiler.AbstractCompilerMojo.getToolchain(AbstractCompilerMojo.java:1530)
        at 
org.apache.maven.plugin.compiler.AbstractCompilerMojo.compiler(AbstractCompilerMojo.java:1046)
        at 
org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1000)
        at 
org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:157)
        at 
org.apache.maven.plugin.compiler.CompilerMojoTestCase.testCompileSkipTest(CompilerMojoTestCase.java:371)
   ```
   
   I do not know how Mockito works (I do not use it myself), but I suspect that 
the following method of `maven-plugin-testing-harness` needs modification:
   
   ```
   
org.apache.maven.api.plugin.testing.stubs.SessionMock.getMockSession(LocalRepository)
   ```
   
   The current implementation seems to define the behaviour of 
`getService(Class)` for various classes (`RepositoryFactory`, `VersionParser`, 
`LocalRepositoryManager`, `ArtifactInstaller`, `ArtifactDeployer`, 
`ArtifactManager`, `ProjectManager`, `ArtifactFactory`, `ProjectBuilder`, 
`ModelXmlFactory`), but I see no setting for `Lookup`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to