Usage

Maven Runtime allows introspection of Maven project metadata at runtime. The main entry point is the MavenRuntime Plexus component. The following example describes the basic usage of the component:

/**
 * @component
 */
private MavenRuntime runtime;

public void printProjects() throws MavenRuntimeException
{
    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    
    for ( MavenProjectProperties properties : runtime.getProjectsProperties( classLoader ) )
    {
        System.out.println( properties );
    }
}

This method will display the group id, artifact id and version of every Maven project within the current thread's context class loader.