mirror of https://github.com/apache/maven.git
o adding metadata needed by DefaultRuntimeInformation
o adding required plexus component descriptors git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@291966 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
15e28864eb
commit
d672c383ce
|
@ -1,4 +1,8 @@
|
|||
import org.apache.maven.embedder.*;
|
||||
import org.apache.maven.project.*;
|
||||
import org.apache.maven.monitor.event.*;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
public class Plugin
|
||||
{
|
||||
|
@ -14,6 +18,20 @@ public class Plugin
|
|||
maven.start();
|
||||
|
||||
System.out.println( "Happy happy joy joy!" );
|
||||
|
||||
System.out.println( "Now build a project" );
|
||||
|
||||
File targetDirectory = new File( System.getProperty( "user.dir" ), "target/embedder-test-project" );
|
||||
|
||||
System.out.println( ">> " + targetDirectory );
|
||||
|
||||
File pomFile = new File( targetDirectory, "pom.xml" );
|
||||
|
||||
MavenProject pom = maven.readProjectWithDependencies( pomFile );
|
||||
|
||||
EventDispatcher eventDispatcher = new DefaultEventDispatcher();
|
||||
|
||||
maven.execute( pom, Collections.singletonList( "package" ), eventDispatcher, targetDirectory );
|
||||
}
|
||||
|
||||
public static void main( String[] args )
|
||||
|
|
|
@ -43,3 +43,7 @@ work. jvz.
|
|||
and what the default values would be if they aren't set.
|
||||
|
||||
-- Need to make an input handler to IDE use soon.
|
||||
|
||||
-- having to add all the component descriptors by hand and the maven
|
||||
version metadata is a real drag. something needs to be added to
|
||||
the assembly plugin.
|
||||
|
|
|
@ -21,8 +21,12 @@
|
|||
<exclude>junit:junit</exclude>
|
||||
<exclude>commons-lang:commons-lang</exclude>
|
||||
<exclude>commons-logging:commons-logging</exclude>
|
||||
<exclude>commons-cli:commons-cli</exclude>
|
||||
<exclude>commons-cli:commons-cli</exclude>
|
||||
<!--
|
||||
I should be able to exclude this because I don't want tool integrators
|
||||
to have to use this at all ...
|
||||
<exclude>jline:jline</exclude>
|
||||
-->
|
||||
<!--
|
||||
|
|
||||
| When the embedder API provides deployment options this can be put
|
||||
|
|
|
@ -66,6 +66,8 @@ import java.util.Collections;
|
|||
*/
|
||||
public class MavenEmbedder
|
||||
{
|
||||
public static final String userHome = System.getProperty( "user.home" );
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Embedder
|
||||
// ----------------------------------------------------------------------
|
||||
|
@ -118,6 +120,8 @@ public class MavenEmbedder
|
|||
|
||||
private String globalChecksumPolicy;
|
||||
|
||||
private File mavenHome;
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Accessors
|
||||
// ----------------------------------------------------------------------
|
||||
|
@ -217,6 +221,16 @@ public class MavenEmbedder
|
|||
return localRepositoryDirectory;
|
||||
}
|
||||
|
||||
public File getMavenHome()
|
||||
{
|
||||
return mavenHome;
|
||||
}
|
||||
|
||||
public void setMavenHome( File mavenHome )
|
||||
{
|
||||
this.mavenHome = mavenHome;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Embedder Client Contract
|
||||
// ----------------------------------------------------------------------
|
||||
|
@ -402,6 +416,25 @@ public class MavenEmbedder
|
|||
public void start()
|
||||
throws MavenEmbedderException
|
||||
{
|
||||
// ----------------------------------------------------------------------
|
||||
// Set the maven.home system property which is need by components like
|
||||
// the plugin registry builder.
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
// TODO: create a maven.home discovery method.
|
||||
|
||||
if ( mavenHome == null )
|
||||
{
|
||||
mavenHome = new File( userHome, "m2" );
|
||||
|
||||
if ( !mavenHome.exists() )
|
||||
{
|
||||
throw new IllegalStateException( "You have set a maven home, or the default of ~/m2 must exist on your system." );
|
||||
}
|
||||
|
||||
System.setProperty( "maven.home", mavenHome.getAbsolutePath() );
|
||||
}
|
||||
|
||||
if ( classLoader == null )
|
||||
{
|
||||
throw new IllegalStateException( "A classloader must be specified using setClassLoader(ClassLoader)." );
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Sun Sep 25 18:25:58 GMT-05:00 2005
|
||||
version=2.0-beta-2-SNAPSHOT
|
||||
groupId=org.apache.maven
|
||||
artifactId=maven-core
|
|
@ -0,0 +1,154 @@
|
|||
<project>
|
||||
<parent>
|
||||
<artifactId>maven</artifactId>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<version>2.0-beta-2-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-core</artifactId>
|
||||
<name>Maven</name>
|
||||
<version>2.0-beta-2-SNAPSHOT</version>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>RELEASE</version>
|
||||
<configuration>
|
||||
<descriptor>src/assemble/bin.xml</descriptor>
|
||||
<finalName>maven-2.0-beta-1</finalName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-settings</artifactId>
|
||||
<version>2.0-beta-2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-file</artifactId>
|
||||
<version>1.0-alpha-4</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-http-lightweight</artifactId>
|
||||
<version>1.0-alpha-4</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.reporting</groupId>
|
||||
<artifactId>maven-reporting-api</artifactId>
|
||||
<version>2.0-beta-2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-profile</artifactId>
|
||||
<version>2.0-beta-2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-model</artifactId>
|
||||
<version>2.0-beta-2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
<version>2.0-beta-2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>plexus</groupId>
|
||||
<artifactId>plexus-container-default</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-provider-api</artifactId>
|
||||
<version>1.0-alpha-4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-repository-metadata</artifactId>
|
||||
<version>2.0-beta-2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-project</artifactId>
|
||||
<version>2.0-beta-2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-registry</artifactId>
|
||||
<version>2.0-beta-2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-cli</groupId>
|
||||
<artifactId>commons-cli</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>2.0-beta-2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>plexus</groupId>
|
||||
<artifactId>plexus-input-handler</artifactId>
|
||||
<version>1.0-alpha-2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-descriptor</artifactId>
|
||||
<version>2.0-beta-2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-monitor</artifactId>
|
||||
<version>2.0-beta-2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact-manager</artifactId>
|
||||
<version>2.0-beta-2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-ssh</artifactId>
|
||||
<version>1.0-alpha-4</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jsch</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<version>0.1.21</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<reporting>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-clover-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-pmd-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
<distributionManagement>
|
||||
<site>
|
||||
<id>website</id>
|
||||
<url>scp://minotaur.apache.org//www/maven.apache.org/m2</url>
|
||||
</site>
|
||||
</distributionManagement>
|
||||
</project>
|
|
@ -873,6 +873,15 @@
|
|||
<userRegistryPath>${user.home}/.m2/plugin-registry.xml</userRegistryPath>
|
||||
</configuration>
|
||||
</component>
|
||||
|
||||
<!-- Plexus components -->
|
||||
|
||||
<component>
|
||||
<role>org.codehaus.plexus.components.inputhandler.InputHandler</role>
|
||||
<implementation>org.codehaus.plexus.components.inputhandler.DefaultInputHandler</implementation>
|
||||
<instantiation-strategy>per-lookup</instantiation-strategy>
|
||||
</component>
|
||||
|
||||
|
||||
</components>
|
||||
</component-set>
|
||||
|
|
Loading…
Reference in New Issue