You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2008/09/11 23:35:32 UTC

svn commit: r694496 - in /maven/plugins/trunk/maven-reactor-plugin: ./ src/main/java/org/apache/maven/plugin/reactor/ src/site/ src/site/apt/ src/test/java/org/apache/maven/plugin/reactor/

Author: bentmann
Date: Thu Sep 11 14:35:31 2008
New Revision: 694496

URL: http://svn.apache.org/viewvc?rev=694496&view=rev
Log:
o Set svn:eol-style=native

Modified:
    maven/plugins/trunk/maven-reactor-plugin/TODO.txt   (contents, props changed)
    maven/plugins/trunk/maven-reactor-plugin/pom.xml   (props changed)
    maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/MakeDependentsMojo.java   (contents, props changed)
    maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/MakeMojo.java   (props changed)
    maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/MakeScmChanges.java   (contents, props changed)
    maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/MissingProjectException.java   (contents, props changed)
    maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/NonReactorException.java   (contents, props changed)
    maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/RelativePather.java   (contents, props changed)
    maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/ResumeMojo.java   (props changed)
    maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/SimpleInvoker.java   (contents, props changed)
    maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/SuperProjectSorter.java   (contents, props changed)
    maven/plugins/trunk/maven-reactor-plugin/src/site/apt/examples.apt.vm   (props changed)
    maven/plugins/trunk/maven-reactor-plugin/src/site/apt/index.apt   (props changed)
    maven/plugins/trunk/maven-reactor-plugin/src/site/site.xml   (props changed)
    maven/plugins/trunk/maven-reactor-plugin/src/test/java/org/apache/maven/plugin/reactor/RelativePatherTest.java   (contents, props changed)

Modified: maven/plugins/trunk/maven-reactor-plugin/TODO.txt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-reactor-plugin/TODO.txt?rev=694496&r1=694495&r2=694496&view=diff
==============================================================================
--- maven/plugins/trunk/maven-reactor-plugin/TODO.txt (original)
+++ maven/plugins/trunk/maven-reactor-plugin/TODO.txt Thu Sep 11 14:35:31 2008
@@ -1,6 +1,6 @@
-integration tests
-deal with sibling aggregators (which use <module>../blah</module>) ... can we do that with -r?  Should we generate a temporary POM instead?
-basic unit test - would require injecting ProjectSorter (can somebody give me a hint?)
-graduate from sandbox
-make a reverse dependency tree
-
+integration tests
+deal with sibling aggregators (which use <module>../blah</module>) ... can we do that with -r?  Should we generate a temporary POM instead?
+basic unit test - would require injecting ProjectSorter (can somebody give me a hint?)
+graduate from sandbox
+make a reverse dependency tree
+

Propchange: maven/plugins/trunk/maven-reactor-plugin/TODO.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-reactor-plugin/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/MakeDependentsMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/MakeDependentsMojo.java?rev=694496&r1=694495&r2=694496&view=diff
==============================================================================
--- maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/MakeDependentsMojo.java (original)
+++ maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/MakeDependentsMojo.java Thu Sep 11 14:35:31 2008
@@ -1,49 +1,49 @@
-package org.apache.maven.plugin.reactor;
-
-/*
- * Copyright 2008 The Apache Software Foundation.
- *
- * Licensed 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.util.List;
-import java.util.Set;
-
-import org.codehaus.plexus.util.dag.Vertex;
-
-/**
- * Goal to build a project X and all of the reactor projects that depend on X 
- *
- * @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
- * @goal make-dependents
- * @aggregator
- * @phase process-sources
- */
-public class MakeDependentsMojo
-    extends MakeMojo
-{
-    // gather parents instead of children
-    protected Set gatherProjects( Vertex v, SuperProjectSorter ps, Set visited, Set out )
-    {
-        visited.add(v);
-        out.add(ps.getProjectMap().get(v.getLabel()));
-        List parents = v.getParents();
-        for (int i = 0; i < parents.size(); i++) {
-            Vertex parent = (Vertex) parents.get(i);
-            if (visited.contains(parent)) continue;
-            gatherProjects(parent, ps, visited, out);
-        }
-        return out;
-    }
-}
+package org.apache.maven.plugin.reactor;
+
+/*
+ * Copyright 2008 The Apache Software Foundation.
+ *
+ * Licensed 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.util.List;
+import java.util.Set;
+
+import org.codehaus.plexus.util.dag.Vertex;
+
+/**
+ * Goal to build a project X and all of the reactor projects that depend on X 
+ *
+ * @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
+ * @goal make-dependents
+ * @aggregator
+ * @phase process-sources
+ */
+public class MakeDependentsMojo
+    extends MakeMojo
+{
+    // gather parents instead of children
+    protected Set gatherProjects( Vertex v, SuperProjectSorter ps, Set visited, Set out )
+    {
+        visited.add(v);
+        out.add(ps.getProjectMap().get(v.getLabel()));
+        List parents = v.getParents();
+        for (int i = 0; i < parents.size(); i++) {
+            Vertex parent = (Vertex) parents.get(i);
+            if (visited.contains(parent)) continue;
+            gatherProjects(parent, ps, visited, out);
+        }
+        return out;
+    }
+}

Propchange: maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/MakeDependentsMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/MakeMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/MakeScmChanges.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/MakeScmChanges.java?rev=694496&r1=694495&r2=694496&view=diff
==============================================================================
--- maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/MakeScmChanges.java (original)
+++ maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/MakeScmChanges.java Thu Sep 11 14:35:31 2008
@@ -1,148 +1,148 @@
-package org.apache.maven.plugin.reactor;
-
-/*
- * Copyright 2008 The Apache Software Foundation.
- *
- * Licensed 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.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.scm.ScmFile;
-import org.apache.maven.scm.ScmFileSet;
-import org.apache.maven.scm.ScmFileStatus;
-import org.apache.maven.scm.command.status.StatusScmResult;
-import org.apache.maven.scm.manager.ScmManager;
-import org.apache.maven.scm.repository.ScmRepository;
-import org.codehaus.plexus.util.StringUtils;
-
-/**
- * Goal to build all projects that you personally have changed (according to SCM)
- * 
- * @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
- * @goal make-scm-changes
- * @aggregator
- * @phase process-sources
- */
-public class MakeScmChanges
-    extends MakeDependentsMojo
-{
-    /**
-     * The SCM connection/provider info.  Should be specified in your POM.
-     * @parameter expression="${make.scmConnection}" default-value="${project.scm.connection}"
-     * @required
-     */
-    private String scmConnection;
-
-    /**
-     * Ignore files in the "unknown" status (created but not added to source control)
-     * 
-     * @parameter expression="${make.ignoreUnknown}" default-value=true
-     */
-    private boolean ignoreUnknown = true;
-
-    /**
-     * @component
-     */
-    private ScmManager scmManager;
-
-    public void execute()
-        throws MojoExecutionException, MojoFailureException
-    {
-        if ( collectedProjects.size() == 0 )
-        {
-            throw new NonReactorException();
-        }
-        if ( scmConnection == null )
-        {
-            throw new MojoFailureException("No SCM connection specified.  You must specify an SCM connection by adding a <connection> element to your <scm> element in your POM");
-        }
-        StatusScmResult result = null;
-        try
-        {
-            ScmRepository repository = scmManager.makeScmRepository( scmConnection );
-            result = scmManager.status( repository, new ScmFileSet( baseDir ) );
-        }
-        catch ( Exception e )
-        {
-            throw new MojoExecutionException( "Couldn't configure SCM repository: " + e.getLocalizedMessage(), e );
-        }
-
-        List changedFiles = result.getChangedFiles();
-        
-        List projectDirectories = getProjectDirectories();
-        Set changedDirectories = new HashSet();
-        for ( int i = 0; i < changedFiles.size(); i++ )
-        {
-            ScmFile changedScmFile = (ScmFile) changedFiles.get( i );
-            getLog().debug( changedScmFile.toString() );
-            ScmFileStatus status = changedScmFile.getStatus();
-            if ( !status.isStatus() )
-            {
-                getLog().debug( "Not a diff: " + status );
-                continue;
-            }
-            if ( ignoreUnknown && ScmFileStatus.UNKNOWN.equals( status ) )
-            {
-                getLog().debug( "Ignoring unknown" );
-                continue;
-            }
-
-            File changedFile = new File( changedScmFile.getPath() );
-            boolean found = false;
-            // TODO There's a cleverer/faster way to code this, right?  This is O(n^2)
-            for ( int j = 0; j < projectDirectories.size(); j++ )
-            {
-                File projectDirectory = (File) projectDirectories.get( j );
-                if ( changedFile.getAbsolutePath().startsWith( projectDirectory.getAbsolutePath() + File.separator ) )
-                {
-                    String path = RelativePather.getRelativePath( baseDir, projectDirectory );
-                    if ( !changedDirectories.contains( path ) )
-                    {
-                        getLog().debug( "Including " + path );
-                    }
-                    changedDirectories.add( path );
-                    found = true;
-                    break;
-                }
-            }
-            if ( !found )
-            {
-                getLog().debug( "Couldn't find file in any reactor root: " + changedFile.getAbsolutePath() );
-            }
-        }
-        folderList = StringUtils.join( changedDirectories.iterator(), "," );
-        getLog().info( "Going to make dependents for: " + folderList );
-        super.execute();
-
-    }
-
-    private List getProjectDirectories()
-    {
-        List dirs = new ArrayList( collectedProjects.size() );
-        for ( int i = 0; i < collectedProjects.size(); i++ )
-        {
-            MavenProject mp = (MavenProject) collectedProjects.get( i );
-            dirs.add( mp.getFile().getParentFile() );
-        }
-        return dirs;
-    }
-
-}
+package org.apache.maven.plugin.reactor;
+
+/*
+ * Copyright 2008 The Apache Software Foundation.
+ *
+ * Licensed 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.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.scm.ScmFile;
+import org.apache.maven.scm.ScmFileSet;
+import org.apache.maven.scm.ScmFileStatus;
+import org.apache.maven.scm.command.status.StatusScmResult;
+import org.apache.maven.scm.manager.ScmManager;
+import org.apache.maven.scm.repository.ScmRepository;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * Goal to build all projects that you personally have changed (according to SCM)
+ * 
+ * @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
+ * @goal make-scm-changes
+ * @aggregator
+ * @phase process-sources
+ */
+public class MakeScmChanges
+    extends MakeDependentsMojo
+{
+    /**
+     * The SCM connection/provider info.  Should be specified in your POM.
+     * @parameter expression="${make.scmConnection}" default-value="${project.scm.connection}"
+     * @required
+     */
+    private String scmConnection;
+
+    /**
+     * Ignore files in the "unknown" status (created but not added to source control)
+     * 
+     * @parameter expression="${make.ignoreUnknown}" default-value=true
+     */
+    private boolean ignoreUnknown = true;
+
+    /**
+     * @component
+     */
+    private ScmManager scmManager;
+
+    public void execute()
+        throws MojoExecutionException, MojoFailureException
+    {
+        if ( collectedProjects.size() == 0 )
+        {
+            throw new NonReactorException();
+        }
+        if ( scmConnection == null )
+        {
+            throw new MojoFailureException("No SCM connection specified.  You must specify an SCM connection by adding a <connection> element to your <scm> element in your POM");
+        }
+        StatusScmResult result = null;
+        try
+        {
+            ScmRepository repository = scmManager.makeScmRepository( scmConnection );
+            result = scmManager.status( repository, new ScmFileSet( baseDir ) );
+        }
+        catch ( Exception e )
+        {
+            throw new MojoExecutionException( "Couldn't configure SCM repository: " + e.getLocalizedMessage(), e );
+        }
+
+        List changedFiles = result.getChangedFiles();
+        
+        List projectDirectories = getProjectDirectories();
+        Set changedDirectories = new HashSet();
+        for ( int i = 0; i < changedFiles.size(); i++ )
+        {
+            ScmFile changedScmFile = (ScmFile) changedFiles.get( i );
+            getLog().debug( changedScmFile.toString() );
+            ScmFileStatus status = changedScmFile.getStatus();
+            if ( !status.isStatus() )
+            {
+                getLog().debug( "Not a diff: " + status );
+                continue;
+            }
+            if ( ignoreUnknown && ScmFileStatus.UNKNOWN.equals( status ) )
+            {
+                getLog().debug( "Ignoring unknown" );
+                continue;
+            }
+
+            File changedFile = new File( changedScmFile.getPath() );
+            boolean found = false;
+            // TODO There's a cleverer/faster way to code this, right?  This is O(n^2)
+            for ( int j = 0; j < projectDirectories.size(); j++ )
+            {
+                File projectDirectory = (File) projectDirectories.get( j );
+                if ( changedFile.getAbsolutePath().startsWith( projectDirectory.getAbsolutePath() + File.separator ) )
+                {
+                    String path = RelativePather.getRelativePath( baseDir, projectDirectory );
+                    if ( !changedDirectories.contains( path ) )
+                    {
+                        getLog().debug( "Including " + path );
+                    }
+                    changedDirectories.add( path );
+                    found = true;
+                    break;
+                }
+            }
+            if ( !found )
+            {
+                getLog().debug( "Couldn't find file in any reactor root: " + changedFile.getAbsolutePath() );
+            }
+        }
+        folderList = StringUtils.join( changedDirectories.iterator(), "," );
+        getLog().info( "Going to make dependents for: " + folderList );
+        super.execute();
+
+    }
+
+    private List getProjectDirectories()
+    {
+        List dirs = new ArrayList( collectedProjects.size() );
+        for ( int i = 0; i < collectedProjects.size(); i++ )
+        {
+            MavenProject mp = (MavenProject) collectedProjects.get( i );
+            dirs.add( mp.getFile().getParentFile() );
+        }
+        return dirs;
+    }
+
+}

Propchange: maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/MakeScmChanges.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/MissingProjectException.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/MissingProjectException.java?rev=694496&r1=694495&r2=694496&view=diff
==============================================================================
--- maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/MissingProjectException.java (original)
+++ maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/MissingProjectException.java Thu Sep 11 14:35:31 2008
@@ -1,31 +1,31 @@
-package org.apache.maven.plugin.reactor;
-
-/*
- * Copyright 2008 The Apache Software Foundation.
- *
- * Licensed 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 org.apache.maven.plugin.MojoFailureException;
-
-class MissingProjectException
-    extends MojoFailureException
-{
-
-    private static final long serialVersionUID = 1L;
-
-    public MissingProjectException(String project)
-    {
-        super( "Couldn't find project " + project + " in reactor; make sure you specified the correct group:artifactId (may differ from folder name)" );
-    }
-}
+package org.apache.maven.plugin.reactor;
+
+/*
+ * Copyright 2008 The Apache Software Foundation.
+ *
+ * Licensed 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 org.apache.maven.plugin.MojoFailureException;
+
+class MissingProjectException
+    extends MojoFailureException
+{
+
+    private static final long serialVersionUID = 1L;
+
+    public MissingProjectException(String project)
+    {
+        super( "Couldn't find project " + project + " in reactor; make sure you specified the correct group:artifactId (may differ from folder name)" );
+    }
+}

Propchange: maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/MissingProjectException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/NonReactorException.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/NonReactorException.java?rev=694496&r1=694495&r2=694496&view=diff
==============================================================================
--- maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/NonReactorException.java (original)
+++ maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/NonReactorException.java Thu Sep 11 14:35:31 2008
@@ -1,29 +1,29 @@
-package org.apache.maven.plugin.reactor;
-
-/*
- * Copyright 2008 The Apache Software Foundation.
- *
- * Licensed 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 org.apache.maven.plugin.MojoFailureException;
-
-class NonReactorException
-    extends MojoFailureException
-{
-    private static final long serialVersionUID = 1L;
-
-    public NonReactorException() {
-        super("This isn't a reactor build.  This command must be run from the root of the reactor (the project with <modules> in it)");
-    }
-}
+package org.apache.maven.plugin.reactor;
+
+/*
+ * Copyright 2008 The Apache Software Foundation.
+ *
+ * Licensed 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 org.apache.maven.plugin.MojoFailureException;
+
+class NonReactorException
+    extends MojoFailureException
+{
+    private static final long serialVersionUID = 1L;
+
+    public NonReactorException() {
+        super("This isn't a reactor build.  This command must be run from the root of the reactor (the project with <modules> in it)");
+    }
+}

Propchange: maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/NonReactorException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/RelativePather.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/RelativePather.java?rev=694496&r1=694495&r2=694496&view=diff
==============================================================================
--- maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/RelativePather.java (original)
+++ maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/RelativePather.java Thu Sep 11 14:35:31 2008
@@ -1,117 +1,117 @@
-package org.apache.maven.plugin.reactor;
-
-/*
- * Copyright 2008 The Apache Software Foundation.
- *
- * Licensed 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.Iterator;
-import java.util.LinkedList;
-
-/**
- * Calculates relative paths
- * @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
- *
- */
-class RelativePather {
-    /**
-     * Calculates a relative path
-     * @param context the "current" context directory
-     * @param dest the directory to be described by a relative path
-     * @return a relative path from the context directory to the dest directory
-     */
-    public static String getRelativePath(File context, File dest) {
-        LinkedList contextChunks = getPathChunks(context);
-        LinkedList destChunks = getPathChunks(dest);
-        if (!contextChunks.getFirst().equals(destChunks.getFirst())) throw new DifferentRootsException("Roots differ");
-        int count = 0;
-        Iterator contextChunker = contextChunks.iterator();
-        Iterator destChunker = destChunks.iterator();
-        String contextChunk = (String) contextChunker.next();
-        String destChunk = (String) destChunker.next();
-        boolean pathsDiffer = false;
-        while (true) {
-            count++;
-            if (!contextChunker.hasNext()) break;
-            if (!destChunker.hasNext()) break;
-            contextChunk = (String) contextChunker.next();
-            destChunk = (String) destChunker.next();
-            if (!contextChunk.equals(destChunk)) {
-                pathsDiffer = true;
-                break;
-            }
-        }
-        
-        // the paths agree for the first N chunks
-        
-        StringBuffer relativePath = new StringBuffer();
-        
-        if (count < contextChunks.size()) {
-            int dotDotCount = contextChunks.size() - count;
-            for (int i = 0; i < dotDotCount; i++) {
-                relativePath.append("..");
-                // omit trailing slash
-                if (i < dotDotCount -1) {
-                    relativePath.append(File.separatorChar);
-                }
-            }
-        }
-        if (pathsDiffer) {
-            if (relativePath.length() > 0) {
-                relativePath.append(File.separatorChar);
-            }
-            relativePath.append(destChunk);
-        }
-        while (destChunker.hasNext()) {
-            if (relativePath.length() > 0) {
-                relativePath.append(File.separatorChar);
-            }
-            relativePath.append(destChunker.next());
-        }
-        
-        return relativePath.toString();
-    }
-    
-    private static LinkedList getPathChunks(File f) {
-        LinkedList l = new LinkedList();
-        while (f.getParentFile() != null) {
-            l.addFirst(f.getName());
-            f = f.getParentFile();
-        }
-        l.addFirst(f.getAbsolutePath());
-        return l;
-    }
-    
-    static class DifferentRootsException extends RuntimeException {
-        private static final long serialVersionUID = 1L;
-
-        public DifferentRootsException() {
-            super();
-        }
-
-        public DifferentRootsException(String message, Throwable cause) {
-            super(message, cause);
-        }
-
-        public DifferentRootsException(String message) {
-            super(message);
-        }
-
-        public DifferentRootsException(Throwable cause) {
-            super(cause);
-        }
-        
-    }
-}
+package org.apache.maven.plugin.reactor;
+
+/*
+ * Copyright 2008 The Apache Software Foundation.
+ *
+ * Licensed 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.Iterator;
+import java.util.LinkedList;
+
+/**
+ * Calculates relative paths
+ * @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
+ *
+ */
+class RelativePather {
+    /**
+     * Calculates a relative path
+     * @param context the "current" context directory
+     * @param dest the directory to be described by a relative path
+     * @return a relative path from the context directory to the dest directory
+     */
+    public static String getRelativePath(File context, File dest) {
+        LinkedList contextChunks = getPathChunks(context);
+        LinkedList destChunks = getPathChunks(dest);
+        if (!contextChunks.getFirst().equals(destChunks.getFirst())) throw new DifferentRootsException("Roots differ");
+        int count = 0;
+        Iterator contextChunker = contextChunks.iterator();
+        Iterator destChunker = destChunks.iterator();
+        String contextChunk = (String) contextChunker.next();
+        String destChunk = (String) destChunker.next();
+        boolean pathsDiffer = false;
+        while (true) {
+            count++;
+            if (!contextChunker.hasNext()) break;
+            if (!destChunker.hasNext()) break;
+            contextChunk = (String) contextChunker.next();
+            destChunk = (String) destChunker.next();
+            if (!contextChunk.equals(destChunk)) {
+                pathsDiffer = true;
+                break;
+            }
+        }
+        
+        // the paths agree for the first N chunks
+        
+        StringBuffer relativePath = new StringBuffer();
+        
+        if (count < contextChunks.size()) {
+            int dotDotCount = contextChunks.size() - count;
+            for (int i = 0; i < dotDotCount; i++) {
+                relativePath.append("..");
+                // omit trailing slash
+                if (i < dotDotCount -1) {
+                    relativePath.append(File.separatorChar);
+                }
+            }
+        }
+        if (pathsDiffer) {
+            if (relativePath.length() > 0) {
+                relativePath.append(File.separatorChar);
+            }
+            relativePath.append(destChunk);
+        }
+        while (destChunker.hasNext()) {
+            if (relativePath.length() > 0) {
+                relativePath.append(File.separatorChar);
+            }
+            relativePath.append(destChunker.next());
+        }
+        
+        return relativePath.toString();
+    }
+    
+    private static LinkedList getPathChunks(File f) {
+        LinkedList l = new LinkedList();
+        while (f.getParentFile() != null) {
+            l.addFirst(f.getName());
+            f = f.getParentFile();
+        }
+        l.addFirst(f.getAbsolutePath());
+        return l;
+    }
+    
+    static class DifferentRootsException extends RuntimeException {
+        private static final long serialVersionUID = 1L;
+
+        public DifferentRootsException() {
+            super();
+        }
+
+        public DifferentRootsException(String message, Throwable cause) {
+            super(message, cause);
+        }
+
+        public DifferentRootsException(String message) {
+            super(message);
+        }
+
+        public DifferentRootsException(Throwable cause) {
+            super(cause);
+        }
+        
+    }
+}

Propchange: maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/RelativePather.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/ResumeMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/SimpleInvoker.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/SimpleInvoker.java?rev=694496&r1=694495&r2=694496&view=diff
==============================================================================
--- maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/SimpleInvoker.java (original)
+++ maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/SimpleInvoker.java Thu Sep 11 14:35:31 2008
@@ -1,104 +1,104 @@
-package org.apache.maven.plugin.reactor;
-
-/*
- * Copyright 2008 The Apache Software Foundation.
- *
- * Licensed 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.util.List;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.logging.Log;
-import org.apache.maven.shared.invoker.CommandLineConfigurationException;
-import org.apache.maven.shared.invoker.DefaultInvocationRequest;
-import org.apache.maven.shared.invoker.InvocationRequest;
-import org.apache.maven.shared.invoker.InvocationResult;
-import org.apache.maven.shared.invoker.Invoker;
-import org.apache.maven.shared.invoker.MavenCommandLineBuilder;
-
-/** Simplified wrapper for Maven invoker
- * 
- * @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
- *
- */
-class SimpleInvoker
-{
-    /** Runs a "mvn --reactor" build with the specified includes
-     * 
-     * @param reactorIncludes the list of include patterns for --reactor
-     * @param goalList the list of goals (you can also pass other flags in here; they're just command-line args)
-     * @param invoker the Maven Invoker (let Maven provide to you as a component)
-     * @param printOnly if true, don't actually run anything, just log a message
-     * @param log logger
-     * @throws InvokerExecutionException if build fails for any reason
-     */
-    void runReactor( String[] reactorIncludes, List goalList, Invoker invoker, boolean printOnly, Log log )
-        throws InvokerExecutionException
-    {
-        InvocationRequest request = new DefaultInvocationRequest();
-        request.activateReactor( reactorIncludes, null/* excludes */);
-        request.setGoals( goalList );
-        request.setRecursive( false );
-        try
-        {
-            log.info( "Executing: " + new MavenCommandLineBuilder().build( request ) );
-        }
-        catch ( CommandLineConfigurationException e )
-        {
-            throw new InvokerExecutionException( "Failed to display command line", e );
-        }
-
-        if ( !printOnly )
-        {
-            try
-            {
-                InvocationResult result = invoker.execute( request );
-                if ( result.getExecutionException() != null )
-                    throw result.getExecutionException();
-                if ( result.getExitCode() != 0 )
-                    throw new InvokerExecutionException( "Exit code was " + result.getExitCode() );
-            }
-            catch ( Exception e )
-            {
-                throw new InvokerExecutionException( "Maven build failed: " + e.getLocalizedMessage(), e );
-            }
-        }
-    }
-    
-    class InvokerExecutionException extends MojoExecutionException {
-
-        private static final long serialVersionUID = 1L;
-
-        public InvokerExecutionException( Object source, String shortMessage, String longMessage )
-        {
-            super( source, shortMessage, longMessage );
-        }
-
-        public InvokerExecutionException( String message, Exception cause )
-        {
-            super( message, cause );
-        }
-
-        public InvokerExecutionException( String message, Throwable cause )
-        {
-            super( message, cause );
-        }
-
-        public InvokerExecutionException( String message )
-        {
-            super( message );
-        }
-        
-    }
-}
+package org.apache.maven.plugin.reactor;
+
+/*
+ * Copyright 2008 The Apache Software Foundation.
+ *
+ * Licensed 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.util.List;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.shared.invoker.CommandLineConfigurationException;
+import org.apache.maven.shared.invoker.DefaultInvocationRequest;
+import org.apache.maven.shared.invoker.InvocationRequest;
+import org.apache.maven.shared.invoker.InvocationResult;
+import org.apache.maven.shared.invoker.Invoker;
+import org.apache.maven.shared.invoker.MavenCommandLineBuilder;
+
+/** Simplified wrapper for Maven invoker
+ * 
+ * @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
+ *
+ */
+class SimpleInvoker
+{
+    /** Runs a "mvn --reactor" build with the specified includes
+     * 
+     * @param reactorIncludes the list of include patterns for --reactor
+     * @param goalList the list of goals (you can also pass other flags in here; they're just command-line args)
+     * @param invoker the Maven Invoker (let Maven provide to you as a component)
+     * @param printOnly if true, don't actually run anything, just log a message
+     * @param log logger
+     * @throws InvokerExecutionException if build fails for any reason
+     */
+    void runReactor( String[] reactorIncludes, List goalList, Invoker invoker, boolean printOnly, Log log )
+        throws InvokerExecutionException
+    {
+        InvocationRequest request = new DefaultInvocationRequest();
+        request.activateReactor( reactorIncludes, null/* excludes */);
+        request.setGoals( goalList );
+        request.setRecursive( false );
+        try
+        {
+            log.info( "Executing: " + new MavenCommandLineBuilder().build( request ) );
+        }
+        catch ( CommandLineConfigurationException e )
+        {
+            throw new InvokerExecutionException( "Failed to display command line", e );
+        }
+
+        if ( !printOnly )
+        {
+            try
+            {
+                InvocationResult result = invoker.execute( request );
+                if ( result.getExecutionException() != null )
+                    throw result.getExecutionException();
+                if ( result.getExitCode() != 0 )
+                    throw new InvokerExecutionException( "Exit code was " + result.getExitCode() );
+            }
+            catch ( Exception e )
+            {
+                throw new InvokerExecutionException( "Maven build failed: " + e.getLocalizedMessage(), e );
+            }
+        }
+    }
+    
+    class InvokerExecutionException extends MojoExecutionException {
+
+        private static final long serialVersionUID = 1L;
+
+        public InvokerExecutionException( Object source, String shortMessage, String longMessage )
+        {
+            super( source, shortMessage, longMessage );
+        }
+
+        public InvokerExecutionException( String message, Exception cause )
+        {
+            super( message, cause );
+        }
+
+        public InvokerExecutionException( String message, Throwable cause )
+        {
+            super( message, cause );
+        }
+
+        public InvokerExecutionException( String message )
+        {
+            super( message );
+        }
+        
+    }
+}

Propchange: maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/SimpleInvoker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/SuperProjectSorter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/SuperProjectSorter.java?rev=694496&r1=694495&r2=694496&view=diff
==============================================================================
--- maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/SuperProjectSorter.java (original)
+++ maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/SuperProjectSorter.java Thu Sep 11 14:35:31 2008
@@ -1,247 +1,247 @@
-package org.apache.maven.plugin.reactor;
-
-/*
- * 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.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.maven.artifact.ArtifactUtils;
-import org.apache.maven.model.Dependency;
-import org.apache.maven.model.Extension;
-import org.apache.maven.model.Plugin;
-import org.apache.maven.model.ReportPlugin;
-import org.apache.maven.project.DuplicateProjectException;
-import org.apache.maven.project.MavenProject;
-import org.codehaus.plexus.util.dag.CycleDetectedException;
-import org.codehaus.plexus.util.dag.DAG;
-import org.codehaus.plexus.util.dag.TopologicalSorter;
-
-/**
- * Sort projects by dependencies.  Just like ProjectSorter from maven-project, but this one exposes
- * the DAG and the projectMap in getters.
- *  
- *
- * @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- */
-public class SuperProjectSorter
-{
-    private final DAG dag;
-
-    private final Map projectMap;
-    
-    private final List sortedProjects;
-
-    private MavenProject topLevelProject;
-
-    /**
-     * Sort a list of projects.
-     * <ul>
-     * <li>collect all the vertices for the projects that we want to build.</li>
-     * <li>iterate through the deps of each project and if that dep is within
-     * the set of projects we want to build then add an edge, otherwise throw
-     * the edge away because that dependency is not within the set of projects
-     * we are trying to build. we assume a closed set.</li>
-     * <li>do a topo sort on the graph that remains.</li>
-     * </ul>
-     * @throws DuplicateProjectException if any projects are duplicated by id
-     */
-    public SuperProjectSorter( List projects )
-        throws CycleDetectedException, DuplicateProjectException
-    {
-        dag = new DAG();
-
-        projectMap = new HashMap();
-
-        for ( Iterator i = projects.iterator(); i.hasNext(); )
-        {
-            MavenProject project = (MavenProject) i.next();
-
-            String id = ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() );
-
-            if ( dag.getVertex( id ) != null )
-            {
-                throw new DuplicateProjectException( "Project '" + id + "' is duplicated in the reactor" );
-            }
-
-            dag.addVertex( id );
-
-            projectMap.put( id, project );
-        }
-
-        for ( Iterator i = projects.iterator(); i.hasNext(); )
-        {
-            MavenProject project = (MavenProject) i.next();
-
-            String id = ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() );
-
-            for ( Iterator j = project.getDependencies().iterator(); j.hasNext(); )
-            {
-                Dependency dependency = (Dependency) j.next();
-
-                String dependencyId = ArtifactUtils
-                    .versionlessKey( dependency.getGroupId(), dependency.getArtifactId() );
-
-                if ( dag.getVertex( dependencyId ) != null )
-                {
-                    project.addProjectReference( (MavenProject) projectMap.get( dependencyId ) );
-
-                    dag.addEdge( id, dependencyId );
-                }
-            }
-
-            MavenProject parent = project.getParent();
-            if ( parent != null )
-            {
-                String parentId = ArtifactUtils.versionlessKey( parent.getGroupId(), parent.getArtifactId() );
-                if ( dag.getVertex( parentId ) != null )
-                {
-                    // Parent is added as an edge, but must not cause a cycle - so we remove any other edges it has in conflict
-                    if ( dag.hasEdge( parentId, id ) )
-                    {
-                        dag.removeEdge( parentId, id );
-                    }
-                    dag.addEdge( id, parentId );
-                }
-            }
-
-            List buildPlugins = project.getBuildPlugins();
-            if ( buildPlugins != null )
-            {
-                for ( Iterator j = buildPlugins.iterator(); j.hasNext(); )
-                {
-                    Plugin plugin = (Plugin) j.next();
-                    String pluginId = ArtifactUtils.versionlessKey( plugin.getGroupId(), plugin.getArtifactId() );
-                    if ( dag.getVertex( pluginId ) != null && !pluginId.equals( id ) )
-                    {
-                        addEdgeWithParentCheck( projectMap, pluginId, project, id );
-                    }
-                }
-            }
-
-            List reportPlugins = project.getReportPlugins();
-            if ( reportPlugins != null )
-            {
-                for ( Iterator j = reportPlugins.iterator(); j.hasNext(); )
-                {
-                    ReportPlugin plugin = (ReportPlugin) j.next();
-                    String pluginId = ArtifactUtils.versionlessKey( plugin.getGroupId(), plugin.getArtifactId() );
-                    if ( dag.getVertex( pluginId ) != null && !pluginId.equals( id ) )
-                    {
-                        addEdgeWithParentCheck( projectMap, pluginId, project, id );
-                    }
-                }
-            }
-
-            for ( Iterator j = project.getBuildExtensions().iterator(); j.hasNext(); )
-            {
-                Extension extension = (Extension) j.next();
-                String extensionId = ArtifactUtils.versionlessKey( extension.getGroupId(), extension.getArtifactId() );
-                if ( dag.getVertex( extensionId ) != null )
-                {
-                    addEdgeWithParentCheck( projectMap, extensionId, project, id );
-                }
-            }
-        }
-
-        List sortedProjects = new ArrayList();
-
-        for ( Iterator i = TopologicalSorter.sort( dag ).iterator(); i.hasNext(); )
-        {
-            String id = (String) i.next();
-
-            sortedProjects.add( projectMap.get( id ) );
-        }
-
-        this.sortedProjects = Collections.unmodifiableList( sortedProjects );
-    }
-
-    private void addEdgeWithParentCheck( Map projectMap, String projectRefId, MavenProject project, String id )
-        throws CycleDetectedException
-    {
-        MavenProject extProject = (MavenProject) projectMap.get( projectRefId );
-        
-        if ( extProject == null )
-        {
-            return;
-        }
-
-        project.addProjectReference( extProject );
-
-        MavenProject extParent = extProject.getParent();
-        if ( extParent != null )
-        {
-            String parentId = ArtifactUtils.versionlessKey( extParent.getGroupId(), extParent.getArtifactId() );
-            // Don't add edge from parent to extension if a reverse edge already exists
-            if ( !dag.hasEdge( projectRefId, id ) || !parentId.equals( id ) )
-            {
-                dag.addEdge( id, projectRefId );
-            }
-        }
-    }
-
-    // TODO: !![jc; 28-jul-2005] check this; if we're using '-r' and there are aggregator tasks, this will result in weirdness.
-    public MavenProject getTopLevelProject()
-    {
-        if ( topLevelProject == null )
-        {
-            for ( Iterator i = sortedProjects.iterator(); i.hasNext() && topLevelProject == null; )
-            {
-                MavenProject project = (MavenProject) i.next();
-                if ( project.isExecutionRoot() )
-                {
-                    topLevelProject = project;
-                }
-            }
-        }
-
-        return topLevelProject;
-    }
-
-    public List getSortedProjects()
-    {
-        return sortedProjects;
-    }
-
-    public boolean hasMultipleProjects()
-    {
-        return sortedProjects.size() > 1;
-    }
-
-    public List getDependents( String id )
-    {
-        return dag.getParentLabels( id );
-    }
-    
-    public DAG getDAG()
-    {
-        return dag;
-    }
-    
-    public Map getProjectMap()
-    {
-        return projectMap;
-    }
-    
-}
+package org.apache.maven.plugin.reactor;
+
+/*
+ * 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.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.artifact.ArtifactUtils;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Extension;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.ReportPlugin;
+import org.apache.maven.project.DuplicateProjectException;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.dag.CycleDetectedException;
+import org.codehaus.plexus.util.dag.DAG;
+import org.codehaus.plexus.util.dag.TopologicalSorter;
+
+/**
+ * Sort projects by dependencies.  Just like ProjectSorter from maven-project, but this one exposes
+ * the DAG and the projectMap in getters.
+ *  
+ *
+ * @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public class SuperProjectSorter
+{
+    private final DAG dag;
+
+    private final Map projectMap;
+    
+    private final List sortedProjects;
+
+    private MavenProject topLevelProject;
+
+    /**
+     * Sort a list of projects.
+     * <ul>
+     * <li>collect all the vertices for the projects that we want to build.</li>
+     * <li>iterate through the deps of each project and if that dep is within
+     * the set of projects we want to build then add an edge, otherwise throw
+     * the edge away because that dependency is not within the set of projects
+     * we are trying to build. we assume a closed set.</li>
+     * <li>do a topo sort on the graph that remains.</li>
+     * </ul>
+     * @throws DuplicateProjectException if any projects are duplicated by id
+     */
+    public SuperProjectSorter( List projects )
+        throws CycleDetectedException, DuplicateProjectException
+    {
+        dag = new DAG();
+
+        projectMap = new HashMap();
+
+        for ( Iterator i = projects.iterator(); i.hasNext(); )
+        {
+            MavenProject project = (MavenProject) i.next();
+
+            String id = ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() );
+
+            if ( dag.getVertex( id ) != null )
+            {
+                throw new DuplicateProjectException( "Project '" + id + "' is duplicated in the reactor" );
+            }
+
+            dag.addVertex( id );
+
+            projectMap.put( id, project );
+        }
+
+        for ( Iterator i = projects.iterator(); i.hasNext(); )
+        {
+            MavenProject project = (MavenProject) i.next();
+
+            String id = ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() );
+
+            for ( Iterator j = project.getDependencies().iterator(); j.hasNext(); )
+            {
+                Dependency dependency = (Dependency) j.next();
+
+                String dependencyId = ArtifactUtils
+                    .versionlessKey( dependency.getGroupId(), dependency.getArtifactId() );
+
+                if ( dag.getVertex( dependencyId ) != null )
+                {
+                    project.addProjectReference( (MavenProject) projectMap.get( dependencyId ) );
+
+                    dag.addEdge( id, dependencyId );
+                }
+            }
+
+            MavenProject parent = project.getParent();
+            if ( parent != null )
+            {
+                String parentId = ArtifactUtils.versionlessKey( parent.getGroupId(), parent.getArtifactId() );
+                if ( dag.getVertex( parentId ) != null )
+                {
+                    // Parent is added as an edge, but must not cause a cycle - so we remove any other edges it has in conflict
+                    if ( dag.hasEdge( parentId, id ) )
+                    {
+                        dag.removeEdge( parentId, id );
+                    }
+                    dag.addEdge( id, parentId );
+                }
+            }
+
+            List buildPlugins = project.getBuildPlugins();
+            if ( buildPlugins != null )
+            {
+                for ( Iterator j = buildPlugins.iterator(); j.hasNext(); )
+                {
+                    Plugin plugin = (Plugin) j.next();
+                    String pluginId = ArtifactUtils.versionlessKey( plugin.getGroupId(), plugin.getArtifactId() );
+                    if ( dag.getVertex( pluginId ) != null && !pluginId.equals( id ) )
+                    {
+                        addEdgeWithParentCheck( projectMap, pluginId, project, id );
+                    }
+                }
+            }
+
+            List reportPlugins = project.getReportPlugins();
+            if ( reportPlugins != null )
+            {
+                for ( Iterator j = reportPlugins.iterator(); j.hasNext(); )
+                {
+                    ReportPlugin plugin = (ReportPlugin) j.next();
+                    String pluginId = ArtifactUtils.versionlessKey( plugin.getGroupId(), plugin.getArtifactId() );
+                    if ( dag.getVertex( pluginId ) != null && !pluginId.equals( id ) )
+                    {
+                        addEdgeWithParentCheck( projectMap, pluginId, project, id );
+                    }
+                }
+            }
+
+            for ( Iterator j = project.getBuildExtensions().iterator(); j.hasNext(); )
+            {
+                Extension extension = (Extension) j.next();
+                String extensionId = ArtifactUtils.versionlessKey( extension.getGroupId(), extension.getArtifactId() );
+                if ( dag.getVertex( extensionId ) != null )
+                {
+                    addEdgeWithParentCheck( projectMap, extensionId, project, id );
+                }
+            }
+        }
+
+        List sortedProjects = new ArrayList();
+
+        for ( Iterator i = TopologicalSorter.sort( dag ).iterator(); i.hasNext(); )
+        {
+            String id = (String) i.next();
+
+            sortedProjects.add( projectMap.get( id ) );
+        }
+
+        this.sortedProjects = Collections.unmodifiableList( sortedProjects );
+    }
+
+    private void addEdgeWithParentCheck( Map projectMap, String projectRefId, MavenProject project, String id )
+        throws CycleDetectedException
+    {
+        MavenProject extProject = (MavenProject) projectMap.get( projectRefId );
+        
+        if ( extProject == null )
+        {
+            return;
+        }
+
+        project.addProjectReference( extProject );
+
+        MavenProject extParent = extProject.getParent();
+        if ( extParent != null )
+        {
+            String parentId = ArtifactUtils.versionlessKey( extParent.getGroupId(), extParent.getArtifactId() );
+            // Don't add edge from parent to extension if a reverse edge already exists
+            if ( !dag.hasEdge( projectRefId, id ) || !parentId.equals( id ) )
+            {
+                dag.addEdge( id, projectRefId );
+            }
+        }
+    }
+
+    // TODO: !![jc; 28-jul-2005] check this; if we're using '-r' and there are aggregator tasks, this will result in weirdness.
+    public MavenProject getTopLevelProject()
+    {
+        if ( topLevelProject == null )
+        {
+            for ( Iterator i = sortedProjects.iterator(); i.hasNext() && topLevelProject == null; )
+            {
+                MavenProject project = (MavenProject) i.next();
+                if ( project.isExecutionRoot() )
+                {
+                    topLevelProject = project;
+                }
+            }
+        }
+
+        return topLevelProject;
+    }
+
+    public List getSortedProjects()
+    {
+        return sortedProjects;
+    }
+
+    public boolean hasMultipleProjects()
+    {
+        return sortedProjects.size() > 1;
+    }
+
+    public List getDependents( String id )
+    {
+        return dag.getParentLabels( id );
+    }
+    
+    public DAG getDAG()
+    {
+        return dag;
+    }
+    
+    public Map getProjectMap()
+    {
+        return projectMap;
+    }
+    
+}

Propchange: maven/plugins/trunk/maven-reactor-plugin/src/main/java/org/apache/maven/plugin/reactor/SuperProjectSorter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-reactor-plugin/src/site/apt/examples.apt.vm
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-reactor-plugin/src/site/apt/index.apt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-reactor-plugin/src/site/site.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/plugins/trunk/maven-reactor-plugin/src/test/java/org/apache/maven/plugin/reactor/RelativePatherTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-reactor-plugin/src/test/java/org/apache/maven/plugin/reactor/RelativePatherTest.java?rev=694496&r1=694495&r2=694496&view=diff
==============================================================================
--- maven/plugins/trunk/maven-reactor-plugin/src/test/java/org/apache/maven/plugin/reactor/RelativePatherTest.java (original)
+++ maven/plugins/trunk/maven-reactor-plugin/src/test/java/org/apache/maven/plugin/reactor/RelativePatherTest.java Thu Sep 11 14:35:31 2008
@@ -1,70 +1,70 @@
-package org.apache.maven.plugin.reactor;
-
-import java.io.File;
-
-import org.apache.maven.plugin.reactor.RelativePather.DifferentRootsException;
-
-import junit.framework.TestCase;
-
-public class RelativePatherTest extends TestCase {
-    File root;
-    File differentRoot;
-    char S = File.separatorChar;
-    
-    public void setUp() {
-        File[] roots = File.listRoots();
-        root = roots[0];
-        if (roots.length > 1) {
-            differentRoot = roots[1];
-        }
-    }
-    
-    public void testIdenticalRoots() {
-        assertEquals("", getRelativePath(root, root));
-    }
-    
-    public void testDifferentRoots() {
-        // skip this test on systems with only one root
-        if (differentRoot == null) return;
-        try {
-            getRelativePath(root, differentRoot);
-            fail("Expected different roots exception");
-        } catch (DifferentRootsException e) {}
-    }
-    
-    public void testIdenticalFoo() {
-        File foo = new File(root, "foo");
-        assertEquals("", getRelativePath(foo, foo));
-    }
-    
-    public void testIdenticalFooFoo() {
-        File foo = new File(root, "foo/foo");
-        assertEquals("", getRelativePath(foo, foo));
-    }
-    
-    public void testFooBar() {
-        File foo = new File(root, "foo");
-        File bar = new File(root, "bar");   
-        assertEquals(".." + S + "bar", getRelativePath(foo, bar));
-    }
-    
-    public void testRootFoo() {
-        File foo = new File(root, "foo");
-        assertEquals("foo", getRelativePath(root, foo));
-    }
-    
-    public void testFooRoot() {
-        File foo = new File(root, "foo");
-        assertEquals("..", getRelativePath(foo, root));
-    }
-
-    public void testFooFooBarBar() {
-        File foo = new File(root, "foo/foo");
-        File bar = new File(root, "bar/bar");   
-        assertEquals(".." + S + ".." + S + "bar" + S + "bar", getRelativePath(foo, bar));
-    }
-    
-    public String getRelativePath(File context, File dest) {
-        return RelativePather.getRelativePath(context, dest);
-    }
-}
+package org.apache.maven.plugin.reactor;
+
+import java.io.File;
+
+import org.apache.maven.plugin.reactor.RelativePather.DifferentRootsException;
+
+import junit.framework.TestCase;
+
+public class RelativePatherTest extends TestCase {
+    File root;
+    File differentRoot;
+    char S = File.separatorChar;
+    
+    public void setUp() {
+        File[] roots = File.listRoots();
+        root = roots[0];
+        if (roots.length > 1) {
+            differentRoot = roots[1];
+        }
+    }
+    
+    public void testIdenticalRoots() {
+        assertEquals("", getRelativePath(root, root));
+    }
+    
+    public void testDifferentRoots() {
+        // skip this test on systems with only one root
+        if (differentRoot == null) return;
+        try {
+            getRelativePath(root, differentRoot);
+            fail("Expected different roots exception");
+        } catch (DifferentRootsException e) {}
+    }
+    
+    public void testIdenticalFoo() {
+        File foo = new File(root, "foo");
+        assertEquals("", getRelativePath(foo, foo));
+    }
+    
+    public void testIdenticalFooFoo() {
+        File foo = new File(root, "foo/foo");
+        assertEquals("", getRelativePath(foo, foo));
+    }
+    
+    public void testFooBar() {
+        File foo = new File(root, "foo");
+        File bar = new File(root, "bar");   
+        assertEquals(".." + S + "bar", getRelativePath(foo, bar));
+    }
+    
+    public void testRootFoo() {
+        File foo = new File(root, "foo");
+        assertEquals("foo", getRelativePath(root, foo));
+    }
+    
+    public void testFooRoot() {
+        File foo = new File(root, "foo");
+        assertEquals("..", getRelativePath(foo, root));
+    }
+
+    public void testFooFooBarBar() {
+        File foo = new File(root, "foo/foo");
+        File bar = new File(root, "bar/bar");   
+        assertEquals(".." + S + ".." + S + "bar" + S + "bar", getRelativePath(foo, bar));
+    }
+    
+    public String getRelativePath(File context, File dest) {
+        return RelativePather.getRelativePath(context, dest);
+    }
+}

Propchange: maven/plugins/trunk/maven-reactor-plugin/src/test/java/org/apache/maven/plugin/reactor/RelativePatherTest.java
------------------------------------------------------------------------------
    svn:eol-style = native