Skip to content

[MNG-8718] Restore Maven 3 compatibility: unable to use ProjectBuilder w/ Maven 4 session #9581

@jira-importer

Description

@jira-importer

Tamas Cservenak opened MNG-8718 and commented

This change is to restore Maven 3 compatibility, as currently it is impossible to use ProjectBuilder from Maven 3 codebase:

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)

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):

/**
 * 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) {
...
}

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.


Remote Links:

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpriority:majorMajor loss of function

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions