/** @plexus.requirement */
private MavenProjectBuilder projectBuilder;
-
+
/** @plexus.requirement */
private ArtifactRepositoryFactory artifactRepositoryFactory;
{
dependency.addElement( "scope" ).setText( artifact.getScope() );
}
+ if ( artifact.getClassifier() != null )
+ {
+ dependency.addElement( "classifier" ).setText( artifact.getClassifier() );
+ }
xmlNode = dependency.addElement( "dependencies" );
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.consumers.ConsumerException;
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
+import org.apache.maven.profiles.DefaultProfileManager;
+import org.codehaus.plexus.spring.PlexusContainerAdapter;
import org.codehaus.plexus.spring.PlexusInSpringTestCase;
public class DependencyTreeGeneratorConsumerTest
throws Exception
{
super.setUp();
-
+
consumer =
(DependencyTreeGeneratorConsumer) lookup( KnownRepositoryContentConsumer.class, "dependency-tree-generator" );
consumer.completeScan();
}
+
+ public void testInvalidCoordinate()
+ throws IOException, ConsumerException
+ {
+ consumer.beginScan( repository );
+
+ String path = "openejb/jaxb-xjc/2.0EA3/jaxb-xjc-2.0EA3.pom";
+ try
+ {
+ consumer.processFile( path );
+
+ fail( "Should not have successfully processed the file" );
+ }
+ catch ( ConsumerException e )
+ {
+ File generatedFile = new File( generatedRepositoryLocation, path + ".xml" );
+ assertFalse( generatedFile.exists() );
+ }
+
+ consumer.completeScan();
+ }
+
+ public void testProfiles()
+ throws IOException, ConsumerException
+ {
+ PlexusContainerAdapter container = new PlexusContainerAdapter();
+ container.setApplicationContext( getApplicationContext() );
+
+ DefaultProfileManager m = new DefaultProfileManager( container );
+
+ consumer.beginScan( repository );
+
+ String path = "org/apache/maven/surefire/surefire-testng/2.0/surefire-testng-2.0.pom";
+ consumer.processFile( path );
+
+ File generatedFile = new File( generatedRepositoryLocation, path + ".xml" );
+ assertEquals( IOUtils.toString( getClass().getResourceAsStream( "/test-data/surefire-testng-2.0-tree.xml" ) ),
+ FileUtils.readFileToString( generatedFile ) );
+
+ consumer.completeScan();
+ }
}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+
+<tree>
+ <dependency>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>surefire-testng</artifactId>
+ <type>jar</type>
+ <version>2.0</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>surefire-api</artifactId>
+ <type>jar</type>
+ <version>2.0</version>
+ <scope>compile</scope>
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ <type>jar</type>
+ <version>1.1</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+ </dependency>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <type>jar</type>
+ <version>4.7</version>
+ <scope>compile</scope>
+ <classifier>jdk15</classifier>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <type>jar</type>
+ <version>3.8.1</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>qdox</groupId>
+ <artifactId>qdox</artifactId>
+ <type>jar</type>
+ <version>1.5</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>bsh</groupId>
+ <artifactId>bsh</artifactId>
+ <type>jar</type>
+ <version>2.0b1</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+ </dependency>
+ </dependencies>
+ </dependency>
+</tree>
--- /dev/null
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>openejb</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.0EA3</version>
+</project>
--- /dev/null
+<?xml version="1.0"?><project>
+ <parent>
+ <artifactId>surefire-providers</artifactId>
+ <groupId>org.apache.maven.surefire</groupId>
+ <version>2.0</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>surefire-testng</artifactId>
+ <name>SureFire TestNG Runner</name>
+ <version>2.0</version>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.4</source>
+ <target>1.4</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <fork>false</fork>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <profiles>
+ <profile>
+ <id>jdk14</id>
+ <activation>
+ <jdk>1.4</jdk>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>4.7</version>
+ <classifier>jdk14</classifier>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>jdk15</id>
+ <activation>
+ <jdk>!1.4</jdk>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>4.7</version>
+ <classifier>jdk15</classifier>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>jdk1.3</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <fork>false</fork>
+ <compilerVersion>1.4</compilerVersion>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>once</forkMode>
+ <jvm>${JAVA_1_3_HOME}/bin/java</jvm>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+ <distributionManagement>
+ <status>deployed</status>
+ </distributionManagement>
+</project>
\ No newline at end of file