Class ApiRunner
java.lang.Object
org.apache.maven.impl.standalone.ApiRunner
Provides functionality for running Maven API in a standalone mode.
This class serves as the main entry point for executing Maven operations outside of the standard Maven build environment. It provides methods for creating and managing Maven sessions in a simplified context, primarily for testing and specialized execution scenarios.
Example usage:
Session session = ApiRunner.createSession(); // Use session for Maven operations
The standalone mode provides a subset of Maven's functionality, with some
features being unavailable or simplified. Operations not supported in
standalone mode will throw UnsupportedInStandaloneModeException
.
- Since:
- 4.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Session
Creates a new Maven session with default configuration.static Session
createSession
(Consumer<Injector> injectorConsumer) Creates a new Maven session with custom injector configuration.static Session
createSession
(Consumer<Injector> injectorConsumer, Path localRepo) Creates a new Maven session with custom injector configuration and local repository path.
-
Constructor Details
-
ApiRunner
public ApiRunner()
-
-
Method Details
-
createSession
-
createSession
-
createSession
Creates a new Maven session with custom injector configuration and local repository path.- Parameters:
injectorConsumer
- consumer function to customize the injectorlocalRepo
- path to the local repository- Returns:
- a new
Session
instance
-