[ 
https://issues.apache.org/jira/browse/MNG-8718?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tamas Cservenak updated MNG-8718:
---------------------------------
    Fix Version/s: 4.0.0-rc-4

> Restore Maven 3 compatibility: unable to use ProjectBuilder w/ Maven 4 session
> ------------------------------------------------------------------------------
>
>                 Key: MNG-8718
>                 URL: https://issues.apache.org/jira/browse/MNG-8718
>             Project: Maven
>          Issue Type: Bug
>            Reporter: Tamas Cservenak
>            Priority: Major
>             Fix For: 4.0.0-rc-4
>
>
> This change is to restore Maven 3 compatibility, as currently it is 
> impossible to use ProjectBuilder from Maven 3 codebase:
> {noformat}
>  java.lang.IllegalArgumentException: session is null
>       at org.apache.maven.impl.Utils.cast(Utils.java:45)
>       at org.apache.maven.impl.InternalSession.from(InternalSession.java:52)
>       at 
> org.apache.maven.project.DefaultProjectBuilder$BuildSession.<init>(DefaultProjectBuilder.java:323)
>       at 
> org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:146)
>       at 
> io.takari.maven.testing.Maven311Runtime.readMavenProject(Maven311Runtime.java:38)
>       at 
> io.takari.maven.testing.AbstractTestMavenRuntime.readMavenProject(AbstractTestMavenRuntime.java:195)
>       at 
> io.takari.maven.testing.AbstractTestMavenRuntime.executeMojo(AbstractTestMavenRuntime.java:221)
>       at basic.UnitTest.testBasic(UnitTest.java:22){noformat}
> And maven3 codebase cannot create Maven 4 session. Hence, given these 
> codebases uses this method (nicely decorated in Maven 4 and ensured nothing 
> is using it):
> {noformat}
> /**
>  * Nobody should ever use this method.
>  *
>  * @deprecated If you use this method and your code is not in Maven Core, 
> stop doing this.
>  */
> @Deprecated
> public RepositorySystemSession newRepositorySession(MavenExecutionRequest 
> request) {
> ...
> }{noformat}
> But the problem is that session got from here is NOT associated with Maven 4 
> session, but also MavenĀ  3 codebase CANNOT associate it with it.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to