Skip to content

[DISCUSS] ASF Maven use case #872

@cstamas

Description

@cstamas

Howdy, as you know, ASF Maven has a huge problem of being "stuck" on javax.inject NS. The whole (huge) ecosystem is using mixed the old Plexus XML and newer Eclipse Sisu DI interleaved, that builds upon Guice (< 6).

So I had an idea:

  • move Eclipse Sisu fully to jakarta (move everything, even index file) -- this was simple and easy
  • maybe move Maven 3.x to jakarta as well (?)
  • but what happens with legacy? Is transparent usage of both possible?

Then I realised something: Maven luckily is very consequential with classloaders, it uses only Plexus Classworlds to create the loaders. So what would happen, if I create a special ClassRealm that integrates Eclipse Transformer?

After some tinkering, I got it (is very messy right now), but produces this:
https://gist.github.com/cstamas/43e10db3f0b989df5681f504c454e758

Hence, Maven 3 w/ Eclipse Sisu 2-SNAPSHOT (jakarta NS; Guice 7) and TransformerClassRealm (that uses this project) produced "somewhat living" Maven 😄

The Plexus ClassWorlds was hacked (locally) to produce transformer instances only.

And locally was able to build Maven 3 (branch maven-3.10.x) with it, at some costs:

  • I used main branch of this project (did not try with released 1.0.0; would it work maybe? there are quite some changes since 1.0.0)
  • the fact that eclipse-transformer requires slf4j forced me some reshuffle and hence, broke Maven logging; See http://takari.io/book/91-maven-classloading.html#maven-classloading
  • I had to move slf4j (api, jcl-over-slfj4 and simple) to Classworlds bootstrap classloader from maven core classloader (this broke maven logging, but I don't care about it right now)

Code to toy with:

Note: last two must have -Denforcer.skip as they enforce Java 8 but Eclipse Transformer is Java 17.

Also, Maven PR is messiest; the distro /conf is not properly populated yet with Eclipse Transformer...

Current status: Maven Object Graph seems workable with Eclipse Sisu, but something still not good with good oldie Plexus, ie, in case mvn clean invoked, this is error:
https://gist.github.com/cstamas/4b76de9e968bfa873cfbf072cf3747c2

Anyway, will try to move forward with this, as to me, this looks quite workable. Thanks for the project!

Also, if anyone has wish to join, feel free to! 🍻

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions