mirror of https://github.com/apache/maven.git
o adding method to embedder to read a project building up the artifacts
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@291429 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9f80023fce
commit
ea993565a8
|
@ -93,6 +93,11 @@
|
|||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>2.0-beta-2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-core</artifactId>
|
||||
<version>2.0-beta-2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
|
|||
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
|
||||
import org.apache.maven.artifact.repository.DefaultArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
|
||||
import org.apache.maven.profiles.ProfileManager;
|
||||
|
@ -170,6 +171,12 @@ public class MavenEmbedder
|
|||
return mavenProjectBuilder.build( mavenProject, localRepository, profileManager );
|
||||
}
|
||||
|
||||
public MavenProject readProjectWithDependencies( File mavenProject )
|
||||
throws ProjectBuildingException, ArtifactResolutionException
|
||||
{
|
||||
return mavenProjectBuilder.buildWithDependencies( mavenProject, localRepository, profileManager );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Internal utility code
|
||||
// ----------------------------------------------------------------------
|
||||
|
|
|
@ -3,8 +3,11 @@ package org.apache.maven.embedder;
|
|||
import junit.framework.TestCase;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class MavenEmbedderTest
|
||||
extends TestCase
|
||||
|
@ -54,9 +57,17 @@ public class MavenEmbedderTest
|
|||
protected void projectReadingTest()
|
||||
throws Exception
|
||||
{
|
||||
MavenProject project = maven.readProject( getPomFile() );
|
||||
MavenProject project = maven.readProjectWithDependencies( getPomFile() );
|
||||
|
||||
assertEquals( "org.apache.maven", project.getGroupId() );
|
||||
|
||||
Set artifacts = project.getArtifacts();
|
||||
|
||||
assertEquals( 1, artifacts.size() );
|
||||
|
||||
Artifact artifact = (Artifact) artifacts.iterator().next();
|
||||
|
||||
System.out.println( "artifact.getFile().getAbsolutePath() = " + artifact.getFile().getAbsolutePath() );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
<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-model</artifactId>
|
||||
|
@ -36,35 +31,7 @@
|
|||
<dependency>
|
||||
<groupId>plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
<version>1.0.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>all-models</id>
|
||||
<build>
|
||||
<finalName>${pom.artifactId}-${pom.version}-all</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.modello</groupId>
|
||||
<artifactId>modello-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>v3</id>
|
||||
<configuration>
|
||||
<version>3.0.0</version>
|
||||
<packageWithVersion>true</packageWithVersion>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>xpp3-writer</goal>
|
||||
<goal>java</goal>
|
||||
<goal>xpp3-reader</goal>
|
||||
<goal>xsd</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
|
|
Loading…
Reference in New Issue