8000 Adopt MIMA · Issue #217 · moditect/layrry · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Adopt MIMA #217
Open
Open
@cstamas

Description

@cstamas

I'd like to propose for this library to adopt MIMA and delegate "maven like" behavior to it. Current landscape of libraries and apps using Aether/Resolver (without Maven but "as in Maven") is very rough, and almost all the apps retry to do the same thing: mimic Maven, and usually they do it wrongly. MIMA offers solution to this.

https://github.com/maveniverse/mima/tree/main

MIMA is Java 8 library, makes use of latest Resolver versions and makes available all the latest features of it (remote repository filtering, local repository locking, new transport that cuts request count in half and many more).

Basic usage in short: make MIMA context module compile time dependency and use it like this:

        ContextOverrides overrides = ... build it using ContextOverrides.Builder
        try (Context context = Runtimes.INSTANCE.getRuntime().create(overrides)) {
          // use resolver: context carries resolverSystem, resolverSystemSession, remoteRepositories
        }

To make it work, add any MIMA runtime as runtime-only dependencies you need (you don't need them compile time).

There are 3 runtimes:

  • embedded-maven - used when running "embedded in maven" (needed if your library is to be used in Maven)
  • standalone-sisu - used when running "standalone", uses Eclipse Sisu/Guice DI (as in Maven)
  • standalone-static - used when running "standalone", replacement for deprecated ServiceLocator

Naturally, you only need one "standalone-*" runtime, no need for both, while "embedded-maven" may be always present, as it does not stir any water (does not have any transitive dependencies and "activates" itself ONLY when inside Maven).

As Resolver (not MIMA) uses SLF4J for logging, you also need to provide a back-end for it at runtime (at least noop, as you still have access to listeners).

By using that pattern above, your code is transportable between all use cases and is simply oblivious where it runs: it will run transparently inside or outside of Maven.

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

      0