Purpose of this document is to consolidate ideas from Maven users for upcoming 2.1.
A plugin that replaces an executable jar's main method as listed in the META-INF folder. The method could be replaced with a special class added to the jar that is able to download enough Maven to get Maven running on that machine and installed in the user folder. The POM that is inside the jar can then be used to locate that jars dependencies and install them into the user's local repository. If maven is already installed, then it could simply use the maven repository to contain its runtime set, and add all required jars to the classpath right then. This would be similar functionality as the current assembly plugin, except that instead of packaging the Jar with other Jars, it packages a Maven bootstrapper. (I am not very good with Wikis, so if this needs to be reformatted, please do so.)
An alternative design could be:
MavenClassLoader cl = new MavenClassLoader(); // << Contain it all in one .class file? cl.allowRemoteDownload(true); // Defaults to false for security? cl.loadSelfDependencies(); // opens META-INF/maven folders for this artifacts dependencies cl.loadDependency(MavenClassLoader.RUNTIME, "groupid", "artifactid", "version"); // Could have more args for other artifact resolving keys cl.loadDependencyNonTransitive("groupid", "artifactid", "version"); // non-transitive version // some code to set the current thread classloader not shown...
As each class on that thread is loaded the MavenClassLoader would be resposible for checking the user's settings.xml for the repository location, or creating a settings.xml with defaults. Once the repository is located, it will get local copies of the artifacts required for the dependency sets. If the dependencies are not there it can then go to the remote repositories and download them to the local repo. If all of this is done better by first installing enough of the Maven jars, then it should do that instead, and load the dependencies that way.