[jboss-cvs] JBossAS SVN: r78527 - in projects/maven/plugins/release/trunk: .settings and 26 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Sep 15 07:26:46 EDT 2008
Author: wolfc
Date: 2008-09-15 07:26:46 -0400 (Mon, 15 Sep 2008)
New Revision: 78527
Added:
projects/maven/plugins/release/trunk/.classpath
projects/maven/plugins/release/trunk/.gitignore
projects/maven/plugins/release/trunk/.project
projects/maven/plugins/release/trunk/.settings/
projects/maven/plugins/release/trunk/.settings/org.eclipse.jdt.core.prefs
projects/maven/plugins/release/trunk/pom.xml
projects/maven/plugins/release/trunk/release-pom.xml
projects/maven/plugins/release/trunk/src/
projects/maven/plugins/release/trunk/src/main/
projects/maven/plugins/release/trunk/src/main/java/
projects/maven/plugins/release/trunk/src/main/java/org/
projects/maven/plugins/release/trunk/src/main/java/org/apache/
projects/maven/plugins/release/trunk/src/main/java/org/apache/maven/
projects/maven/plugins/release/trunk/src/main/java/org/apache/maven/plugin/
projects/maven/plugins/release/trunk/src/main/java/org/apache/maven/plugin/dependency/
projects/maven/plugins/release/trunk/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyFilterMojo.java
projects/maven/plugins/release/trunk/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyMojo.java
projects/maven/plugins/release/trunk/src/main/java/org/jboss/
projects/maven/plugins/release/trunk/src/main/java/org/jboss/maven/
projects/maven/plugins/release/trunk/src/main/java/org/jboss/maven/artifact/
projects/maven/plugins/release/trunk/src/main/java/org/jboss/maven/artifact/resolver/
projects/maven/plugins/release/trunk/src/main/java/org/jboss/maven/artifact/resolver/DefaultSimpleArtifactResolver.java
projects/maven/plugins/release/trunk/src/main/java/org/jboss/maven/plugin/
projects/maven/plugins/release/trunk/src/main/java/org/jboss/maven/plugin/release/
projects/maven/plugins/release/trunk/src/main/java/org/jboss/maven/plugin/release/GenerateMojo.java
projects/maven/plugins/release/trunk/src/test/
projects/maven/plugins/release/trunk/src/test/java/
projects/maven/plugins/release/trunk/src/test/java/org/
projects/maven/plugins/release/trunk/src/test/java/org/jboss/
projects/maven/plugins/release/trunk/src/test/java/org/jboss/maven/
projects/maven/plugins/release/trunk/src/test/java/org/jboss/maven/plugin/
projects/maven/plugins/release/trunk/src/test/java/org/jboss/maven/plugin/release/
projects/maven/plugins/release/trunk/src/test/java/org/jboss/maven/plugin/release/GenerateMojoTest.java
projects/maven/plugins/release/trunk/src/test/java/org/jboss/maven/plugin/release/stubs/
projects/maven/plugins/release/trunk/src/test/java/org/jboss/maven/plugin/release/stubs/MavenProjectStub.java
projects/maven/plugins/release/trunk/src/test/resources/
projects/maven/plugins/release/trunk/src/test/resources/unit/
projects/maven/plugins/release/trunk/src/test/resources/unit/basic-generate-test/
projects/maven/plugins/release/trunk/src/test/resources/unit/basic-generate-test/plugin-config.xml
projects/maven/plugins/release/trunk/src/test/resources/unit/resolve-test/
projects/maven/plugins/release/trunk/src/test/resources/unit/resolve-test/plugin-config.xml
Modified:
projects/maven/plugins/release/trunk/
Log:
Initial import.
Property changes on: projects/maven/plugins/release/trunk
___________________________________________________________________
Name: svn:ignore
+ .git
target
Added: projects/maven/plugins/release/trunk/.classpath
===================================================================
--- projects/maven/plugins/release/trunk/.classpath (rev 0)
+++ projects/maven/plugins/release/trunk/.classpath 2008-09-15 11:26:46 UTC (rev 78527)
@@ -0,0 +1,7 @@
+<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
+ <classpathentry kind="output" path="target/classes"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+</classpath>
\ No newline at end of file
Added: projects/maven/plugins/release/trunk/.gitignore
===================================================================
--- projects/maven/plugins/release/trunk/.gitignore (rev 0)
+++ projects/maven/plugins/release/trunk/.gitignore 2008-09-15 11:26:46 UTC (rev 78527)
@@ -0,0 +1 @@
+/target
Added: projects/maven/plugins/release/trunk/.project
===================================================================
--- projects/maven/plugins/release/trunk/.project (rev 0)
+++ projects/maven/plugins/release/trunk/.project 2008-09-15 11:26:46 UTC (rev 78527)
@@ -0,0 +1,17 @@
+<projectDescription>
+ <name>maven-jboss-release-plugin</name>
+ <comment>Parent POM for JBoss projects. Provides default project build configuration.</comment>
+ <projects/>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
\ No newline at end of file
Added: projects/maven/plugins/release/trunk/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/maven/plugins/release/trunk/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ projects/maven/plugins/release/trunk/.settings/org.eclipse.jdt.core.prefs 2008-09-15 11:26:46 UTC (rev 78527)
@@ -0,0 +1,5 @@
+#Fri Sep 12 11:47:08 CEST 2008
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
Added: projects/maven/plugins/release/trunk/pom.xml
===================================================================
--- projects/maven/plugins/release/trunk/pom.xml (rev 0)
+++ projects/maven/plugins/release/trunk/pom.xml 2008-09-15 11:26:46 UTC (rev 78527)
@@ -0,0 +1,73 @@
+<!--
+ vi:ts=2:sw=2:expandtab
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-parent</artifactId>
+ <version>4</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.maven.plugin</groupId>
+ <artifactId>maven-jboss-release-plugin</artifactId>
+ <packaging>maven-plugin</packaging>
+ <version>1.0-SNAPSHOT</version>
+ <name>maven-jboss-release-plugin Maven Mojo</name>
+ <!--url>http://maven.apache.org</url-->
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <!-- exclude the copied maven sources (these are for plugin xdoc only) -->
+ <excludes>
+ <exclude>org/apache/**</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>[2.0,)</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.release</groupId>
+ <artifactId>maven-release-manager</artifactId>
+ <version>[0,)</version>
+ <!-- See the maven-release-plugin 2.0-beta-7 -->
+ <exclusions>
+ <exclusion>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-component-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-container-default</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>[2.0,)</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-interceptors</artifactId>
+ <version>0.13.6-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
Added: projects/maven/plugins/release/trunk/release-pom.xml
===================================================================
--- projects/maven/plugins/release/trunk/release-pom.xml (rev 0)
+++ projects/maven/plugins/release/trunk/release-pom.xml 2008-09-15 11:26:46 UTC (rev 78527)
@@ -0,0 +1,351 @@
+<?xml version="1.0" encoding="UTF-8"?><project>
+ <parent>
+ <artifactId>jboss-parent</artifactId>
+ <groupId>org.jboss</groupId>
+ <version>4</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.maven.plugin</groupId>
+ <artifactId>maven-jboss-release-plugin</artifactId>
+ <packaging>maven-plugin</packaging>
+ <name>maven-jboss-release-plugin Maven Mojo</name>
+ <version>1.0-SNAPSHOT</version>
+ <description>Parent POM for JBoss projects. Provides default project build configuration.</description>
+ <url>http://www.jboss.org/maven-jboss-release-plugin</url>
+ <issueManagement>
+ <system>jira</system>
+ <url>http://jira.jboss.org/</url>
+ </issueManagement>
+ <licenses>
+ <license>
+ <name>lgpl</name>
+ <url>http://repository.jboss.org/licenses/lgpl-2.1.txt</url>
+ </license>
+ </licenses>
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/labs/labs/jbossbuild/jboss-parent/tags/jboss-parent-4/maven-jboss-release-plugin</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/labs/labs/jbossbuild/jboss-parent/tags/jboss-parent-4/maven-jboss-release-plugin</developerConnection>
+ </scm>
+ <organization>
+ <name>JBoss, a division of Red Hat, Inc.</name>
+ <url>http://www.jboss.org</url>
+ </organization>
+ <build>
+ <sourceDirectory>/home/carlo/work/maven-jboss-release-plugin/src/main/java</sourceDirectory>
+ <scriptSourceDirectory>src/main/scripts</scriptSourceDirectory>
+ <testSourceDirectory>/home/carlo/work/maven-jboss-release-plugin/src/test/java</testSourceDirectory>
+ <outputDirectory>/home/carlo/work/maven-jboss-release-plugin/target/classes</outputDirectory>
+ <testOutputDirectory>/home/carlo/work/maven-jboss-release-plugin/target/test-classes</testOutputDirectory>
+ <extensions>
+ <extension>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-webdav</artifactId>
+ <version>1.0-beta-2</version>
+ </extension>
+ </extensions>
+ <resources>
+ <resource>
+ <directory>/home/carlo/work/maven-jboss-release-plugin/src/main/resources</directory>
+ </resource>
+ </resources>
+ <testResources>
+ <testResource>
+ <directory>/home/carlo/work/maven-jboss-release-plugin/src/test/resources</directory>
+ </testResource>
+ </testResources>
+ <directory>/home/carlo/work/maven-jboss-release-plugin/target</directory>
+ <finalName>maven-jboss-release-plugin-1.0-SNAPSHOT</finalName>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-2</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.0</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <version>2.3</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-ear-plugin</artifactId>
+ <version>2.3.1</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-ejb-plugin</artifactId>
+ <version>2.1</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-install-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifest>
+ <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
+ <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+ </manifest>
+ <manifestEntries>
+ <Implementation-URL>http://www.jboss.org/maven-jboss-release-plugin</Implementation-URL>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.4</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>2.4.1</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-rar-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-release-plugin</artifactId>
+ <version>2.0-beta-7</version>
+ <configuration>
+ <useReleaseProfile>false</useReleaseProfile>
+ <arguments>-Prelease</arguments>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>2.0-beta-6</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>2.0.4</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.2</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.1-alpha-1</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>2.0.3</version>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ <inherited>true</inherited>
+ </plugin>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <excludes>
+ <exclude>org/apache/**</exclude>
+ </excludes>
+ <archive>
+ <manifest>
+ <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
+ <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+ </manifest>
+ <manifestEntries>
+ <Implementation-URL>http://www.jboss.org/maven-jboss-release-plugin</Implementation-URL>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.jboss.maven.plugin</groupId>
+ <artifactId>maven-jboss-release-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>2.4.1</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.2</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-install-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ </plugins>
+ </build>
+ <repositories>
+ <repository>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots />
+ <id>jboss-snapshots</id>
+ <name>JBoss Snapshot Repository</name>
+ <url>http://snapshots.jboss.org/maven2</url>
+ </repository>
+ <repository>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <id>repository.jboss.com</id>
+ <url>http://repository.jboss.org/maven2</url>
+ </repository>
+ <repository>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <id>central</id>
+ <name>Maven Repository Switchboard</name>
+ <url>http://repo1.maven.org/maven2</url>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <releases>
+ <updatePolicy>never</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <id>central</id>
+ <name>Maven Plugin Repository</name>
+ <url>http://repo1.maven.org/maven2</url>
+ </pluginRepository>
+ </pluginRepositories>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0.8</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.release</groupId>
+ <artifactId>maven-release-manager</artifactId>
+ <version>1.0-alpha-4</version>
+ <scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <artifactId>plexus-component-api</artifactId>
+ <groupId>org.codehaus.plexus</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>plexus-container-default</artifactId>
+ <groupId>org.codehaus.plexus</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.0</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-interceptors</artifactId>
+ <version>0.13.6-20080904.030950-1</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+ <reporting>
+ <outputDirectory>target/site</outputDirectory>
+ <plugins>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <links>
+ <link>http://java.sun.com/j2se/1.5.0/docs/api</link>
+ </links>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <version>2.0.1</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ <version>2.3</version>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>report-only</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>taglist-maven-plugin</artifactId>
+ <version>2.0</version>
+ </plugin>
+ </plugins>
+ </reporting>
+ <distributionManagement>
+ <repository>
+ <id>repository.jboss.org</id>
+ <url>file:///home/carlo/work/repository.jboss.org/maven2</url>
+ </repository>
+ <snapshotRepository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshot Repository</name>
+ <url>dav:https://snapshots.jboss.org/maven2</url>
+ </snapshotRepository>
+ </distributionManagement>
+ <properties>
+ <maven.repository.root>/home/carlo/work/repository.jboss.org/maven2</maven.repository.root>
+ <jboss.repository.root>/home/carlo/work/repository.jboss.org</jboss.repository.root>
+ <maven.cvs.root>/home/carlo/work/repository.jboss.org/maven2</maven.cvs.root>
+ </properties>
+</project>
\ No newline at end of file
Added: projects/maven/plugins/release/trunk/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyFilterMojo.java
===================================================================
--- projects/maven/plugins/release/trunk/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyFilterMojo.java (rev 0)
+++ projects/maven/plugins/release/trunk/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyFilterMojo.java 2008-09-15 11:26:46 UTC (rev 78527)
@@ -0,0 +1,378 @@
+package org.apache.maven.plugin.dependency;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.dependency.utils.DependencyStatusSets;
+import org.apache.maven.plugin.dependency.utils.resolvers.ArtifactsResolver;
+import org.apache.maven.plugin.dependency.utils.resolvers.DefaultArtifactsResolver;
+import org.apache.maven.plugin.dependency.utils.translators.ArtifactTranslator;
+import org.apache.maven.plugin.dependency.utils.translators.ClassifierTypeTranslator;
+import org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException;
+import org.apache.maven.shared.artifact.filter.collection.ArtifactIdFilter;
+import org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter;
+import org.apache.maven.shared.artifact.filter.collection.ClassifierFilter;
+import org.apache.maven.shared.artifact.filter.collection.FilterArtifacts;
+import org.apache.maven.shared.artifact.filter.collection.GroupIdFilter;
+import org.apache.maven.shared.artifact.filter.collection.ScopeFilter;
+import org.apache.maven.shared.artifact.filter.collection.TransitivityFilter;
+import org.apache.maven.shared.artifact.filter.collection.TypeFilter;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * Class that excapusulates the plugin parameters, and contains methods that
+ * handle dependency filtering
+ *
+ * @author <a href="mailto:brianf at apache.org">Brian Fox</a>
+ * @version $Id: AbstractDependencyFilterMojo.java 614346 2008-01-22 22:05:09Z brianf $
+ * @see org.apache.maven.plugin.dependency.AbstractDependencyMojo
+ */
+public abstract class AbstractDependencyFilterMojo
+ extends AbstractDependencyMojo
+{
+ /**
+ * If we should exclude transitive dependencies
+ *
+ * @since 2.0
+ * @optional
+ * @parameter expression="${excludeTransitive}" default-value="false"
+ */
+ protected boolean excludeTransitive;
+
+ /**
+ * Comma Separated list of Types to include. Empty String indicates include
+ * everything (default).
+ *
+ * @since 2.0
+ * @parameter expression="${includeTypes}" default-value=""
+ * @optional
+ */
+ protected String includeTypes;
+
+ /**
+ * Comma Separated list of Types to exclude. Empty String indicates don't
+ * exclude anything (default).
+ *
+ * @since 2.0
+ * @parameter expression="${excludeTypes}" default-value=""
+ * @optional
+ */
+ protected String excludeTypes;
+
+ /**
+ * Scope to include. An Empty string indicates all scopes (default).
+ *
+ * @since 2.0
+ * @parameter expression="${includeScope}" default-value=""
+ * @optional
+ */
+ protected String includeScope;
+
+ /**
+ * Scope to exclude. An Empty string indicates no scopes (default).
+ *
+ * @since 2.0
+ * @parameter expression="${excludeScope}" default-value=""
+ * @optional
+ */
+ protected String excludeScope;
+
+ /**
+ * Comma Separated list of Classifiers to include. Empty String indicates
+ * include everything (default).
+ *
+ * @since 2.0
+ * @parameter expression="${includeClassifiers}" default-value=""
+ * @optional
+ */
+ protected String includeClassifiers;
+
+ /**
+ * Comma Separated list of Classifiers to exclude. Empty String indicates
+ * don't exclude anything (default).
+ *
+ * @since 2.0
+ * @parameter expression="${excludeClassifiers}" default-value=""
+ * @optional
+ */
+ protected String excludeClassifiers;
+
+ /**
+ * Specify classifier to look for. Example: sources
+ *
+ * @optional
+ * @since 2.0
+ * @parameter expression="${classifier}" default-value=""
+ */
+ protected String classifier;
+
+ /**
+ * Specify type to look for when constructing artifact based on classifier.
+ * Example: java-source,jar,war
+ *
+ * @optional
+ * @since 2.0
+ * @parameter expression="${type}" default-value="java-source"
+ */
+ protected String type;
+
+ /**
+ * Comma separated list of Artifact names too exclude.
+ *
+ * @since 2.0
+ * @optional
+ * @parameter expression="${excludeArtifactIds}" default-value=""
+ */
+ protected String excludeArtifactIds;
+
+ /**
+ * Comma separated list of Artifact names to include.
+ *
+ * @since 2.0
+ * @optional
+ * @parameter expression="${includeArtifactIds}" default-value=""
+ */
+ protected String includeArtifactIds;
+
+ /**
+ * Comma separated list of GroupId Names to exclude.
+ *
+ * @since 2.0
+ * @optional
+ * @parameter expression="${excludeGroupIds}" default-value=""
+ */
+ protected String excludeGroupIds;
+
+ /**
+ * Comma separated list of GroupIds to include.
+ *
+ * @since 2.0
+ * @optional
+ * @parameter expression="${includeGroupIds}" default-value=""
+ */
+ protected String includeGroupIds;
+
+ /**
+ * Directory to store flag files
+ *
+ * @parameter expression="${markersDirectory}"
+ * default-value="${project.build.directory}/dependency-maven-plugin-markers"
+ * @optional
+ * @since 2.0
+ */
+ protected File markersDirectory;
+
+ /**
+ * Overwrite release artifacts
+ *
+ * @optional
+ * @since 1.0
+ * @parameter expression="${overWriteReleases}" default-value="false"
+ */
+ protected boolean overWriteReleases;
+
+ /**
+ * Overwrite snapshot artifacts
+ *
+ * @optional
+ * @since 1.0
+ * @parameter expression="${overWriteSnapshots}" default-value="false"
+ */
+ protected boolean overWriteSnapshots;
+
+ /**
+ * Overwrite artifacts that don't exist or are older than the source.
+ *
+ * @optional
+ * @since 2.0
+ * @parameter expression="${overWriteIfNewer}" default-value="true"
+ */
+ protected boolean overWriteIfNewer;
+
+ protected abstract ArtifactsFilter getMarkedArtifactFilter();
+
+ /**
+ * Retrieves dependencies, either direct only or all including transitive.
+ *
+ * @return A HashSet of artifacts
+ * @throws MojoExecutionException
+ */
+ protected Set getResolvedDependencies( boolean stopOnFailure )throws MojoExecutionException
+
+ {
+ DependencyStatusSets status = getDependencySets( stopOnFailure );
+
+ return status.getResolvedDependencies();
+ }
+
+ /**
+ *
+ * Method creates filters and filters the projects dependencies. This method
+ * also transforms the dependencies if classifier is set. The dependencies
+ * are filtered in least specific to most specific order
+ *
+ * @param stopOnFailure
+ * @return DependencyStatusSets - Bean of TreeSets that contains information
+ * on the projects dependencies
+ * @throws MojoExecutionException
+ */
+ protected DependencyStatusSets getDependencySets( boolean stopOnFailure )
+ throws MojoExecutionException
+ {
+ // add filters in well known order, least specific to most specific
+ FilterArtifacts filter = new FilterArtifacts();
+
+ filter.addFilter( new TransitivityFilter( project.getDependencyArtifacts(), this.excludeTransitive ) );
+ filter.addFilter( new ScopeFilter( this.includeScope, this.excludeScope ) );
+ filter.addFilter( new TypeFilter( this.includeTypes, this.excludeTypes ) );
+ filter.addFilter( new ClassifierFilter( this.includeClassifiers, this.excludeClassifiers ) );
+ filter.addFilter( new GroupIdFilter( this.includeGroupIds, this.excludeGroupIds ) );
+ filter.addFilter( new ArtifactIdFilter( this.includeArtifactIds, this.excludeArtifactIds ) );
+
+ // start with all artifacts.
+ Set artifacts = project.getArtifacts();
+
+ // perform filtering
+ try
+ {
+ artifacts = filter.filter( artifacts );
+ }
+ catch ( ArtifactFilterException e )
+ {
+ throw new MojoExecutionException(e.getMessage(),e);
+ }
+
+ // transform artifacts if classifier is set
+ DependencyStatusSets status = null;
+ if ( StringUtils.isNotEmpty( classifier ) )
+ {
+ status = getClassifierTranslatedDependencies( artifacts, stopOnFailure );
+ }
+ else
+ {
+ status = filterMarkedDependencies( artifacts );
+ }
+
+ return status;
+ }
+
+ /**
+ *
+ * Transform artifacts
+ *
+ * @param artifacts
+ * @param stopOnFailure
+ * @return DependencyStatusSets - Bean of TreeSets that contains information
+ * on the projects dependencies
+ * @throws MojoExecutionException
+ */
+ protected DependencyStatusSets getClassifierTranslatedDependencies( Set artifacts, boolean stopOnFailure )
+ throws MojoExecutionException
+ {
+ Set unResolvedArtifacts = new HashSet();
+ Set resolvedArtifacts = artifacts;
+ DependencyStatusSets status = new DependencyStatusSets();
+
+ // possibly translate artifacts into a new set of artifacts based on the
+ // classifier and type
+ // if this did something, we need to resolve the new artifacts
+ if ( StringUtils.isNotEmpty( classifier ) )
+ {
+ ArtifactTranslator translator = new ClassifierTypeTranslator( this.classifier, this.type, this.factory );
+ artifacts = translator.translate( artifacts, getLog() );
+
+ status = filterMarkedDependencies( artifacts );
+
+ // the unskipped artifacts are in the resolved set.
+ artifacts = status.getResolvedDependencies();
+
+ // resolve the rest of the artifacts
+ ArtifactsResolver artifactsResolver = new DefaultArtifactsResolver( this.resolver, this.local,
+ this.remoteRepos, stopOnFailure );
+ resolvedArtifacts = artifactsResolver.resolve( artifacts, getLog() );
+
+ // calculate the artifacts not resolved.
+ unResolvedArtifacts.addAll( artifacts );
+ unResolvedArtifacts.removeAll( resolvedArtifacts );
+ }
+
+ // return a bean of all 3 sets.
+ status.setResolvedDependencies( resolvedArtifacts );
+ status.setUnResolvedDependencies( unResolvedArtifacts );
+
+ return status;
+ }
+
+ /**
+ * Filter the marked dependencies
+ *
+ * @param artifacts
+ * @return
+ * @throws MojoExecutionException
+ */
+ protected DependencyStatusSets filterMarkedDependencies( Set artifacts )
+ throws MojoExecutionException
+ {
+ // remove files that have markers already
+ FilterArtifacts filter = new FilterArtifacts();
+ filter.clearFilters();
+ filter.addFilter( getMarkedArtifactFilter() );
+
+ Set unMarkedArtifacts;
+ try
+ {
+ unMarkedArtifacts = filter.filter( artifacts );
+ }
+ catch ( ArtifactFilterException e )
+ {
+ throw new MojoExecutionException(e.getMessage(),e);
+ }
+
+ // calculate the skipped artifacts
+ Set skippedArtifacts = new HashSet();
+ skippedArtifacts.addAll( artifacts );
+ skippedArtifacts.removeAll( unMarkedArtifacts );
+
+ return new DependencyStatusSets( unMarkedArtifacts, null, skippedArtifacts );
+ }
+
+ /**
+ * @return Returns the markersDirectory.
+ */
+ public File getMarkersDirectory()
+ {
+ return this.markersDirectory;
+ }
+
+ /**
+ * @param theMarkersDirectory
+ * The markersDirectory to set.
+ */
+ public void setMarkersDirectory( File theMarkersDirectory )
+ {
+ this.markersDirectory = theMarkersDirectory;
+ }
+
+ // TODO: Set marker files.
+}
Added: projects/maven/plugins/release/trunk/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyMojo.java
===================================================================
--- projects/maven/plugins/release/trunk/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyMojo.java (rev 0)
+++ projects/maven/plugins/release/trunk/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyMojo.java 2008-09-15 11:26:46 UTC (rev 78527)
@@ -0,0 +1,413 @@
+package org.apache.maven.plugin.dependency;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.lang.reflect.Field;
+import java.util.List;
+
+import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
+import org.apache.maven.artifact.resolver.ArtifactCollector;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.dependency.utils.DependencySilentLog;
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.archiver.ArchiverException;
+import org.codehaus.plexus.archiver.UnArchiver;
+import org.codehaus.plexus.archiver.manager.ArchiverManager;
+import org.codehaus.plexus.archiver.manager.NoSuchArchiverException;
+import org.codehaus.plexus.components.io.fileselectors.IncludeExcludeFileSelector;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.ReflectionUtils;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * @author <a href="mailto:brianf at apache.org">Brian Fox</a>
+ * @version $Id: AbstractDependencyMojo.java 552528
+ * 2007-07-02 16:12:47Z markh $
+ */
+public abstract class AbstractDependencyMojo
+ extends AbstractMojo
+{
+ /**
+ * Used to look up Artifacts in the remote repository.
+ *
+ * @parameter expression="${component.org.apache.maven.artifact.factory.ArtifactFactory}"
+ * @required
+ * @readonly
+ */
+ protected org.apache.maven.artifact.factory.ArtifactFactory factory;
+
+ /**
+ * Used to look up Artifacts in the remote repository.
+ *
+ * @parameter expression="${component.org.apache.maven.artifact.resolver.ArtifactResolver}"
+ * @required
+ * @readonly
+ */
+ protected org.apache.maven.artifact.resolver.ArtifactResolver resolver;
+
+ /**
+ * Artifact collector, needed to resolve dependencies.
+ *
+ * @component role="org.apache.maven.artifact.resolver.ArtifactCollector"
+ * @required
+ * @readonly
+ */
+ protected ArtifactCollector artifactCollector;
+
+ /**
+ * @component role="org.apache.maven.artifact.metadata.ArtifactMetadataSource"
+ * hint="maven"
+ * @required
+ * @readonly
+ */
+ protected ArtifactMetadataSource artifactMetadataSource;
+
+ /**
+ * Location of the local repository.
+ *
+ * @parameter expression="${localRepository}"
+ * @readonly
+ * @required
+ */
+ protected org.apache.maven.artifact.repository.ArtifactRepository local;
+
+ /**
+ * List of Remote Repositories used by the resolver
+ *
+ * @parameter expression="${project.remoteArtifactRepositories}"
+ * @readonly
+ * @required
+ */
+ protected java.util.List remoteRepos;
+
+ /**
+ * To look up Archiver/UnArchiver implementations
+ *
+ * @parameter expression="${component.org.codehaus.plexus.archiver.manager.ArchiverManager}"
+ * @required
+ * @readonly
+ */
+ protected ArchiverManager archiverManager;
+
+ /**
+ * POM
+ *
+ * @parameter expression="${project}"
+ * @readonly
+ * @required
+ */
+ protected MavenProject project;
+
+ /**
+ * Contains the full list of projects in the reactor.
+ *
+ * @parameter expression="${reactorProjects}"
+ * @required
+ * @readonly
+ */
+ protected List reactorProjects;
+
+ /**
+ * If the plugin should be silent.
+ *
+ * @optional
+ * @since 2.0
+ * @parameter expression="${silent}"
+ * default-value="false"
+ */
+ public boolean silent;
+
+ /**
+ * Output absolute filename for resolved artifacts
+ *
+ * @optional
+ * @since 2.0
+ * @parameter expression="${outputAbsoluteArtifactFilename}"
+ * default-value="false"
+ */
+ protected boolean outputAbsoluteArtifactFilename;
+
+ private Log log;
+
+ /**
+ * @return Returns the log.
+ */
+ public Log getLog ()
+ {
+ if ( silent )
+ {
+ log = new DependencySilentLog();
+ }
+ else
+ {
+ log = super.getLog();
+ }
+
+ return this.log;
+ }
+
+ /**
+ * @return Returns the archiverManager.
+ */
+ public ArchiverManager getArchiverManager ()
+ {
+ return this.archiverManager;
+ }
+
+ /**
+ * Does the actual copy of the file and logging.
+ *
+ * @param artifact represents the file to copy.
+ * @param destFile file name of destination file.
+ *
+ * @throws MojoExecutionException with a message if an
+ * error occurs.
+ */
+ protected void copyFile ( File artifact, File destFile )
+ throws MojoExecutionException
+ {
+ Log theLog = this.getLog();
+ try
+ {
+ theLog.info( "Copying "
+ + ( this.outputAbsoluteArtifactFilename ? artifact.getAbsolutePath() : artifact.getName() ) + " to "
+ + destFile );
+ FileUtils.copyFile( artifact, destFile );
+
+ }
+ catch ( Exception e )
+ {
+ throw new MojoExecutionException( "Error copying artifact from " + artifact + " to " + destFile, e );
+ }
+ }
+
+ protected void unpack ( File file, File location )
+ throws MojoExecutionException
+ {
+ unpack( file, location, null, null );
+ }
+
+ /**
+ * Unpacks the archive file.
+ *
+ * @param file File to be unpacked.
+ * @param location Location where to put the unpacked
+ * files.
+ * @param includes Comma separated list of file patterns
+ * to include i.e. **\/*.xml,
+ * **\/*.properties
+ * @param excludes Comma separated list of file patterns
+ * to exclude i.e. **\/*.xml,
+ * **\/*.properties
+ */
+ protected void unpack ( File file, File location, String includes, String excludes )
+ throws MojoExecutionException
+ {
+ try
+ {
+ getLog().info(
+ "Unpacking " + file.getPath() + "to\n " + location.getPath()
+ + "\nwith Includes " + includes + " and excludes:" + excludes );
+
+ location.mkdirs();
+
+ UnArchiver unArchiver;
+
+ unArchiver = archiverManager.getUnArchiver( file );
+
+ unArchiver.setSourceFile( file );
+
+ unArchiver.setDestDirectory( location );
+
+ if ( StringUtils.isNotEmpty( excludes ) || StringUtils.isNotEmpty( includes ) )
+ {
+ // Create the selectors that will filter
+ // based on include/exclude parameters
+ // MDEP-47
+ IncludeExcludeFileSelector[] selectors = new IncludeExcludeFileSelector[] { new IncludeExcludeFileSelector() };
+
+ if ( StringUtils.isNotEmpty( excludes ) )
+ {
+ selectors[0].setExcludes( excludes.split( "," ) );
+ }
+
+ if ( StringUtils.isNotEmpty( includes ) )
+ {
+ selectors[0].setIncludes( includes.split( "," ) );
+ }
+
+ unArchiver.setFileSelectors( selectors );
+ }
+ if ( this.silent )
+ {
+ silenceUnarchiver( unArchiver );
+ }
+
+ unArchiver.extract();
+ }
+ catch ( NoSuchArchiverException e )
+ {
+ throw new MojoExecutionException( "Unknown archiver type", e );
+ }
+ catch ( ArchiverException e )
+ {
+ e.printStackTrace();
+ throw new MojoExecutionException( "Error unpacking file: " + file + " to: " + location + "\r\n"
+ + e.toString(), e );
+ }
+ }
+
+ private void silenceUnarchiver ( UnArchiver unArchiver )
+ {
+ // dangerous but handle any errors. It's the only
+ // way to silence the
+ // unArchiver.
+ try
+ {
+ Field field = ReflectionUtils.getFieldByNameIncludingSuperclasses( "logger", unArchiver.getClass() );
+
+ field.setAccessible( true );
+
+ field.set( unArchiver, this.getLog() );
+ }
+ catch ( Exception e )
+ {
+ // was a nice try. Don't bother logging because
+ // the log is silent.
+ }
+ }
+
+ /**
+ * @return Returns the factory.
+ */
+ public org.apache.maven.artifact.factory.ArtifactFactory getFactory ()
+ {
+ return this.factory;
+ }
+
+ /**
+ * @param factory The factory to set.
+ */
+ public void setFactory ( org.apache.maven.artifact.factory.ArtifactFactory factory )
+ {
+ this.factory = factory;
+ }
+
+ /**
+ * @return Returns the project.
+ */
+ public MavenProject getProject ()
+ {
+ return this.project;
+ }
+
+ /**
+ * @return Returns the local.
+ */
+ public org.apache.maven.artifact.repository.ArtifactRepository getLocal ()
+ {
+ return this.local;
+ }
+
+ /**
+ * @param local The local to set.
+ */
+ public void setLocal ( org.apache.maven.artifact.repository.ArtifactRepository local )
+ {
+ this.local = local;
+ }
+
+ /**
+ * @return Returns the remoteRepos.
+ */
+ public java.util.List getRemoteRepos ()
+ {
+ return this.remoteRepos;
+ }
+
+ /**
+ * @param remoteRepos The remoteRepos to set.
+ */
+ public void setRemoteRepos ( java.util.List remoteRepos )
+ {
+ this.remoteRepos = remoteRepos;
+ }
+
+ /**
+ * @return Returns the resolver.
+ */
+ public org.apache.maven.artifact.resolver.ArtifactResolver getResolver ()
+ {
+ return this.resolver;
+ }
+
+ /**
+ * @param resolver The resolver to set.
+ */
+ public void setResolver ( org.apache.maven.artifact.resolver.ArtifactResolver resolver )
+ {
+ this.resolver = resolver;
+ }
+
+ /**
+ * @param archiverManager The archiverManager to set.
+ */
+ public void setArchiverManager ( ArchiverManager archiverManager )
+ {
+ this.archiverManager = archiverManager;
+ }
+
+ /**
+ * @return Returns the artifactCollector.
+ */
+ public ArtifactCollector getArtifactCollector ()
+ {
+ return this.artifactCollector;
+ }
+
+ /**
+ * @param theArtifactCollector The artifactCollector to
+ * set.
+ */
+ public void setArtifactCollector ( ArtifactCollector theArtifactCollector )
+ {
+ this.artifactCollector = theArtifactCollector;
+ }
+
+ /**
+ * @return Returns the artifactMetadataSource.
+ */
+ public ArtifactMetadataSource getArtifactMetadataSource ()
+ {
+ return this.artifactMetadataSource;
+ }
+
+ /**
+ * @param theArtifactMetadataSource The
+ * artifactMetadataSource to set.
+ */
+ public void setArtifactMetadataSource ( ArtifactMetadataSource theArtifactMetadataSource )
+ {
+ this.artifactMetadataSource = theArtifactMetadataSource;
+ }
+}
Added: projects/maven/plugins/release/trunk/src/main/java/org/jboss/maven/artifact/resolver/DefaultSimpleArtifactResolver.java
===================================================================
--- projects/maven/plugins/release/trunk/src/main/java/org/jboss/maven/artifact/resolver/DefaultSimpleArtifactResolver.java (rev 0)
+++ projects/maven/plugins/release/trunk/src/main/java/org/jboss/maven/artifact/resolver/DefaultSimpleArtifactResolver.java 2008-09-15 11:26:46 UTC (rev 78527)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.maven.artifact.resolver;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.manager.WagonManager;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.transform.ArtifactTransformationManager;
+import org.apache.maven.wagon.ResourceDoesNotExistException;
+import org.apache.maven.wagon.TransferFailedException;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class DefaultSimpleArtifactResolver
+{
+ private WagonManager wagonManager;
+ private ArtifactTransformationManager transformationManager;
+
+ public DefaultSimpleArtifactResolver(WagonManager wagonManager, ArtifactTransformationManager transformationManager)
+ {
+ assert wagonManager != null : "wagonManager is null";
+ assert transformationManager != null : "transformationManager is null";
+
+ this.wagonManager = wagonManager;
+ this.transformationManager = transformationManager;
+ }
+
+ public String resolveArtifact(Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository)
+ throws ArtifactNotFoundException, TransferFailedException, ResourceDoesNotExistException, ArtifactResolutionException
+ {
+ transformationManager.transformForResolve( artifact, remoteRepositories, localRepository );
+
+ System.out.println("metadata list: " + artifact.getMetadataList());
+
+ List<ArtifactRepository> repositories = new ArrayList<ArtifactRepository>(remoteRepositories);
+ for (Iterator<ArtifactRepository> i = repositories.iterator(); i.hasNext();)
+ {
+ ArtifactRepository repository = i.next();
+ ArtifactRepositoryPolicy policy = repository.getSnapshots();
+ if (!policy.isEnabled())
+ {
+ i.remove();
+ }
+ }
+
+ if (!wagonManager.isOnline())
+ {
+ throw new ArtifactNotFoundException("System is offline.", artifact);
+ }
+
+ // TODO: force should be passed to the wagon manager
+ if (artifact.getRepository() != null)
+ {
+ // the transformations discovered the artifact - so use it exclusively
+ wagonManager.getArtifact(artifact, artifact.getRepository());
+ }
+ else
+ {
+ wagonManager.getArtifact(artifact, repositories);
+ }
+
+ /*
+ if (!artifact.isResolved())
+ {
+ throw new ArtifactResolutionException(
+ "Failed to resolve artifact, possibly due to a repository list that is not appropriately equipped for this artifact's metadata.",
+ artifact, remoteRepositories);
+ }
+ */
+
+ System.out.println("metadata list: " + artifact.getMetadataList());
+
+ return artifact.getVersion();
+ }
+}
Added: projects/maven/plugins/release/trunk/src/main/java/org/jboss/maven/plugin/release/GenerateMojo.java
===================================================================
--- projects/maven/plugins/release/trunk/src/main/java/org/jboss/maven/plugin/release/GenerateMojo.java (rev 0)
+++ projects/maven/plugins/release/trunk/src/main/java/org/jboss/maven/plugin/release/GenerateMojo.java 2008-09-15 11:26:46 UTC (rev 78527)
@@ -0,0 +1,263 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.maven.plugin.release;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.manager.WagonManager;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
+import org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager;
+import org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException;
+import org.apache.maven.artifact.repository.metadata.Snapshot;
+import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata;
+import org.apache.maven.artifact.repository.metadata.Versioning;
+import org.apache.maven.artifact.transform.ArtifactTransformationManager;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.dependency.AbstractDependencyFilterMojo;
+import org.apache.maven.plugin.dependency.utils.DependencyStatusSets;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter;
+import org.apache.maven.shared.release.util.ReleaseUtil;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.StringUtils;
+import org.jboss.maven.artifact.resolver.DefaultSimpleArtifactResolver;
+
+/**
+ * Generate a proper release-pom.xml.
+ *
+ * @goal generate
+ * @requiresDependencyResolution test
+ * @phase validate
+ */
+public class GenerateMojo extends AbstractDependencyFilterMojo
+{
+ /**
+ * @parameter expression="${component.org.apache.maven.artifact.manager.WagonManager}"
+ * @readonly
+ * @required
+ */
+ private WagonManager wagonManager;
+
+ /**
+ * @parameter expression="${component.org.apache.maven.artifact.transform.ArtifactTransformationManager}"
+ * @readonly
+ * @required
+ */
+ private ArtifactTransformationManager transformationManager;
+
+ /**
+ * @parameter expression="${component.org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager}"
+ * @readonly
+ * @required
+ */
+ private RepositoryMetadataManager manager;
+
+ /**
+ * Location of the local repository.
+ *
+ * @parameter expression="${localRepository}"
+ * @readonly
+ * @required
+ */
+ protected ArtifactRepository localRepository;
+
+ private DefaultSimpleArtifactResolver simpleArtifactResolver;
+
+ /*
+ * @see org.apache.maven.artifact.transform.SnapshotTransformation#constructVersion
+ */
+ protected String constructVersion(Versioning versioning, String baseVersion)
+ {
+ String version = null;
+ Snapshot snapshot = versioning.getSnapshot();
+ if (snapshot != null)
+ {
+ if (snapshot.getTimestamp() != null && snapshot.getBuildNumber() > 0)
+ {
+ String newVersion = snapshot.getTimestamp() + "-" + snapshot.getBuildNumber();
+ version = StringUtils.replace(baseVersion, "SNAPSHOT", newVersion);
+ }
+ else
+ {
+ version = baseVersion;
+ }
+ }
+ return version;
+ }
+
+ protected Model createReleaseModel(Set<Artifact> resolvedDependencies) throws MojoExecutionException
+ {
+ MavenProject releaseProject = new MavenProject(project);
+ releaseProject.setParent(null);
+ Model releaseModel = releaseProject.getModel();
+
+ getLog().info("artifacts:");
+ Set<Artifact> artifacts = resolvedDependencies;
+ for(Artifact artifact : artifacts)
+ {
+ getLog().info(artifact.toString());
+ }
+
+ getLog().info("dependencies:");
+ List<Dependency> dependencies = releaseProject.getDependencies();
+ for(Dependency dependency : dependencies)
+ {
+ Artifact artifact = findMatch(dependency, resolvedDependencies);
+ // if it's an untimestamped snapshot, we need an ultra hack
+ if(artifact.isSnapshot() && artifact.getBaseVersion().equals(artifact.getVersion()))
+ {
+ getLog().info("It's a SNAP " + artifact.getAvailableVersions() + ", " + artifact.getFile());
+ SnapshotArtifactRepositoryMetadata sarm = (SnapshotArtifactRepositoryMetadata) artifact.getMetadataList().iterator().next();
+ getLog().info("snapshot = " + sarm.getMetadata().getVersioning().getVersions());
+
+ resolveSnapshot(artifact);
+
+ /*
+ artifact.setFile(null);
+ artifact.setResolved(false);
+ try
+ {
+ // for some reason 'local' is null
+ if(localRepository == null)
+ throw new IllegalStateException("localRepository is null");
+ resolver.resolveAlways(artifact, remoteRepos, localRepository);
+
+ getLog().info(simpleArtifactResolver.resolveArtifact(artifact, remoteRepos, localRepository));
+ }
+ catch (AbstractArtifactResolutionException e)
+ {
+ throw new MojoExecutionException("TODO", e);
+ }
+ catch (TransferFailedException e)
+ {
+ throw new MojoExecutionException("TODO", e);
+ }
+ catch (ResourceDoesNotExistException e)
+ {
+ throw new MojoExecutionException("TODO", e);
+ }
+ */
+ getLog().info(artifact.getBaseVersion() + " = " + artifact.getVersion());
+ }
+ dependency.setVersion(artifact.getVersion());
+ //getLog().info(dependency.toString());
+ }
+
+ return releaseModel;
+ }
+
+ protected Artifact findMatch(Dependency dependency, Set<Artifact> artifacts)
+ {
+ for (Artifact artifact : artifacts)
+ {
+ if(!artifact.getGroupId().equals(dependency.getGroupId()))
+ continue;
+ if(!artifact.getArtifactId().equals(dependency.getArtifactId()))
+ continue;
+ return artifact;
+ }
+ throw new IllegalArgumentException("Can't find artifact for dependency " + dependency);
+ }
+
+ protected ArtifactsFilter getMarkedArtifactFilter()
+ {
+ //return new ResolveFileFilter( new SourcesFileMarkerHandler( this.markersDirectory ) );
+ return null;
+ }
+
+ public void execute() throws MojoExecutionException
+ {
+ // TODO: how to do this properly?
+ this.local = null;
+
+ this.simpleArtifactResolver = new DefaultSimpleArtifactResolver(wagonManager, transformationManager);
+
+ DependencyStatusSets dependencySets = getDependencySets(true);
+
+ Model releasePom = createReleaseModel(dependencySets.getResolvedDependencies());
+
+ // from org.apache.maven.shared.release.phase.GenerateReleasePomsPhase.generateReleasePom
+ MavenXpp3Writer pomWriter = new MavenXpp3Writer();
+
+ File releasePomFile = ReleaseUtil.getReleasePom( project );
+
+ Writer fileWriter = null;
+
+ try
+ {
+ // TODO use WriterFactory.newXmlWriter() when plexus-utils is upgraded to 1.4.5+
+ fileWriter = new OutputStreamWriter( new FileOutputStream( releasePomFile ), "UTF-8" );
+
+ pomWriter.write( fileWriter, releasePom );
+ }
+ catch ( IOException exception )
+ {
+ throw new MojoExecutionException( "Cannot generate release POM", exception );
+ }
+ finally
+ {
+ IOUtil.close( fileWriter );
+ }
+ }
+
+ private void resolveSnapshot(Artifact artifact) throws MojoExecutionException
+ {
+ SnapshotArtifactRepositoryMetadata metadata = new SnapshotArtifactRepositoryMetadata(artifact);
+ for(ArtifactRepository repository : (List<ArtifactRepository>) remoteRepos)
+ {
+ ArtifactRepositoryPolicy policy = metadata.isSnapshot() ? repository.getSnapshots() : repository.getReleases();
+ if ( !policy.isEnabled() )
+ {
+ getLog().debug( "Skipping disabled repository " + repository.getId() );
+ }
+ else if ( repository.isBlacklisted() )
+ {
+ getLog().debug( "Skipping blacklisted repository " + repository.getId() );
+ }
+ else
+ {
+ try
+ {
+ manager.resolveAlways(metadata, localRepository, repository);
+ }
+ catch (RepositoryMetadataResolutionException e)
+ {
+ throw new MojoExecutionException(e.getMessage(), e);
+ }
+ getLog().info("snapshot = " + metadata.getMetadata().getVersioning().getSnapshot());
+ artifact.updateVersion(constructVersion(metadata.getMetadata().getVersioning(), artifact.getBaseVersion()), localRepository);
+ return;
+ }
+ }
+ }
+}
Added: projects/maven/plugins/release/trunk/src/test/java/org/jboss/maven/plugin/release/GenerateMojoTest.java
===================================================================
--- projects/maven/plugins/release/trunk/src/test/java/org/jboss/maven/plugin/release/GenerateMojoTest.java (rev 0)
+++ projects/maven/plugins/release/trunk/src/test/java/org/jboss/maven/plugin/release/GenerateMojoTest.java 2008-09-15 11:26:46 UTC (rev 78527)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.maven.plugin.release;
+
+import java.io.File;
+
+import org.apache.maven.plugin.testing.AbstractMojoTestCase;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class GenerateMojoTest extends AbstractMojoTestCase
+{
+ public void test1() throws Exception
+ {
+// File testPom = new File( getBasedir(),
+// "target/test-classes/unit/basic-deploy-test/plugin-config.xml" );
+ File testPom = new File( getBasedir(),
+ "src/test/resources/unit/basic-generate-test/plugin-config.xml" );
+
+ GenerateMojo mojo = (GenerateMojo) lookupMojo("generate", testPom);
+
+ assertNotNull(mojo);
+ }
+
+ public void testGenerate() throws Exception
+ {
+ File testPom = new File( getBasedir(),
+ "src/test/resources/unit/basic-generate-test/plugin-config.xml" );
+
+ GenerateMojo mojo = (GenerateMojo) lookupMojo("generate", testPom);
+
+ assertNotNull(mojo);
+
+ mojo.execute();
+ }
+
+// public void testResolve() throws Exception
+// {
+// File testPom = new File( getBasedir(),
+// "src/test/resources/unit/resolve-test/plugin-config.xml" );
+//
+// GenerateMojo mojo = (GenerateMojo) lookupMojo("generate", testPom);
+//
+// assertNotNull(mojo);
+//
+// List<Dependency> dependencies = new ArrayList<Dependency>();
+// Dependency dependency = new Dependency();
+// dependency.setGroupId("org.jboss.ejb3");
+// dependency.setArtifactId("jboss-ejb3-core");
+// dependency.setVersion("0.13.0-SNAPSHOT");
+// dependencies.add(dependency);
+// mojo.getProject().setDependencies(dependencies);
+//
+// mojo.execute();
+// }
+}
Added: projects/maven/plugins/release/trunk/src/test/java/org/jboss/maven/plugin/release/stubs/MavenProjectStub.java
===================================================================
--- projects/maven/plugins/release/trunk/src/test/java/org/jboss/maven/plugin/release/stubs/MavenProjectStub.java (rev 0)
+++ projects/maven/plugins/release/trunk/src/test/java/org/jboss/maven/plugin/release/stubs/MavenProjectStub.java 2008-09-15 11:26:46 UTC (rev 78527)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.maven.plugin.release.stubs;
+
+import java.io.File;
+import java.util.Collections;
+
+import org.apache.maven.model.Model;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class MavenProjectStub extends MavenProject
+{
+ public MavenProjectStub()
+ {
+ this(new Model());
+
+ setPluginArtifacts(Collections.EMPTY_SET);
+ setReportArtifacts(Collections.EMPTY_SET);
+ setExtensionArtifacts(Collections.EMPTY_SET);
+
+ setRemoteArtifactRepositories(Collections.EMPTY_LIST);
+ setPluginArtifactRepositories(Collections.EMPTY_LIST);
+ }
+
+ public MavenProjectStub(Model model)
+ {
+ super(model);
+ }
+
+ @Override
+ public File getFile()
+ {
+ // FIXME
+ return new File("target/pom.xml");
+ }
+}
Added: projects/maven/plugins/release/trunk/src/test/resources/unit/basic-generate-test/plugin-config.xml
===================================================================
--- projects/maven/plugins/release/trunk/src/test/resources/unit/basic-generate-test/plugin-config.xml (rev 0)
+++ projects/maven/plugins/release/trunk/src/test/resources/unit/basic-generate-test/plugin-config.xml 2008-09-15 11:26:46 UTC (rev 78527)
@@ -0,0 +1,22 @@
+<project>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugin</groupId>
+ <artifactId>maven-jboss-release-plugin</artifactId>
+ <configuration>
+ <project implementation="org.jboss.maven.plugin.release.stubs.MavenProjectStub"/>
+ <!--
+ <pomFile>${basedir}/src/test/resources/unit/basic-generate-test/plugin-config.xml</pomFile>
+ <packaging>pom</packaging>
+ <artifact implementation="org.apache.maven.plugin.deploy.stubs.DeployArtifactStub" />
+ <attachedArtifacts />
+ <localRepository>${localRepository}</localRepository>
+ <deploymentRepository implementation="org.apache.maven.plugin.deploy.stubs.ArtifactRepositoryStub" />
+ <updateReleaseInfo>true</updateReleaseInfo>
+ -->
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: projects/maven/plugins/release/trunk/src/test/resources/unit/resolve-test/plugin-config.xml
===================================================================
--- projects/maven/plugins/release/trunk/src/test/resources/unit/resolve-test/plugin-config.xml (rev 0)
+++ projects/maven/plugins/release/trunk/src/test/resources/unit/resolve-test/plugin-config.xml 2008-09-15 11:26:46 UTC (rev 78527)
@@ -0,0 +1,23 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugin</groupId>
+ <artifactId>maven-jboss-release-plugin</artifactId>
+ <configuration>
+ <!--
+ <project implementation="org.jboss.maven.plugin.release.stubs.MavenProjectStub"/>
+ -->
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-interceptors</artifactId>
+ <version>0.13.4-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
More information about the jboss-cvs-commits
mailing list