Index: maven-release-manager/src/test/java/org/apache/maven/shared/release/util/PomFinderTest.java
===================================================================
--- maven-release-manager/src/test/java/org/apache/maven/shared/release/util/PomFinderTest.java	(Revision 0)
+++ maven-release-manager/src/test/java/org/apache/maven/shared/release/util/PomFinderTest.java	(Revision 0)
@@ -0,0 +1,74 @@
+package org.apache.maven.shared.release.util;
+
+/*
+ * 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 org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.logging.LoggerManager;
+
+import java.io.File;
+import java.net.URL;
+
+
+/**
+ * @author <a href="mailto:struberg@yahoo.de">Mark Struberg</a>
+ */
+public class PomFinderTest extends PlexusTestCase
+{
+    private Logger logger = null;
+
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+        LoggerManager lm = (LoggerManager) lookup(LoggerManager.ROLE);
+        logger = lm.getLoggerForComponent(LoggerManager.ROLE); //X TODO use a better ROLE!
+    }
+
+    public void testPomFinderParser() throws Exception
+    {
+        PomFinder pf = new PomFinder( logger );
+
+        boolean found = pf.parsePom( new File( "src/test/resources/pomfinder/pomNothere.xml" ) );
+        assertFalse( found );
+
+        URL pomUrl = getClassLoader().getResource("pomfinder/pom1.xml");
+        assertNotNull( pomUrl );
+
+        File pomFile = new File( pomUrl.getFile() );
+        found = pf.parsePom( pomFile );
+        assertTrue( found );
+
+        {
+            File foundPom = pf.findMatchingPom( pomFile.getParentFile() );
+            assertNotNull( foundPom );
+
+            assertEquals( pomFile.getAbsolutePath(), foundPom.getAbsolutePath() );
+        }
+
+        {
+            // try from 1 directory higher
+            File foundPom = pf.findMatchingPom( pomFile.getParentFile().getParentFile() );
+            assertNotNull( foundPom );
+
+            assertEquals( pomFile.getAbsolutePath(), foundPom.getAbsolutePath() );
+        }
+    }
+
+}
Index: maven-release-manager/src/test/resources/pomfinder/pom1.xml
===================================================================
--- maven-release-manager/src/test/resources/pomfinder/pom1.xml	(Revision 0)
+++ maven-release-manager/src/test/resources/pomfinder/pom1.xml	(Revision 0)
@@ -0,0 +1,223 @@
+<?xml version="1.0" encoding="UTF-8"?>
+  <!--
+  ~ 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.
+  -->
+
+<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">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.maven.release</groupId>
+    <artifactId>maven-release-testartifact</artifactId>
+    <version>2.1-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>maven-release-manager</artifactId>
+
+  <name>Maven Release Manager testartifact</name>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.apache.maven</groupId>
+        <artifactId>maven-repository-metadata</artifactId>
+        <version>${mavenVersion}</version>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-container-default</artifactId>
+      <version>1.0-alpha-9</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+      <version>2.4</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-cli</groupId>
+      <artifactId>commons-cli</artifactId>
+      <version>1.0</version>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-lang</groupId>
+          <artifactId>commons-lang</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+
+    <!-- scm dependencies -->
+
+    <dependency>
+      <groupId>org.apache.maven.scm</groupId>
+      <artifactId>maven-scm-providers-standard</artifactId>
+      <version>${scmVersion}</version>
+      <type>pom</type>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.scm</groupId>
+      <artifactId>maven-scm-manager-plexus</artifactId>
+      <version>${scmVersion}</version>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.scm</groupId>
+      <artifactId>maven-scm-api</artifactId>
+      <version>${scmVersion}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.scm</groupId>
+      <artifactId>maven-scm-provider-svn-commons</artifactId>
+      <version>${scmVersion}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.jdom</groupId>
+      <artifactId>jdom</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>jaxen</groupId>
+      <artifactId>jaxen</artifactId>
+      <version>1.1-beta-8</version>
+      <scope>runtime</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>dom4j</groupId>
+          <artifactId>dom4j</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>xerces</groupId>
+          <artifactId>xmlParserAPIs</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>xerces</groupId>
+          <artifactId>xercesImpl</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>xom</groupId>
+          <artifactId>xom</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.2</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.shared</groupId>
+      <artifactId>maven-plugin-testing-harness</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.scm</groupId>
+      <artifactId>maven-scm-test</artifactId>
+      <version>${scmVersion}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>jmock</groupId>
+      <artifactId>jmock</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>jmock</groupId>
+      <artifactId>jmock-cglib</artifactId>
+      <version>1.0.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <configuration>
+          <!-- Required because the Modello generated classes uses the assert keyword -->
+          <source>1.4</source>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <argLine>-Xmx256m</argLine>
+          <excludes>
+            <!-- Disabled for now - we can't mock classes from plexus-utils in surefire -->
+            <exclude>**/ForkedMavenExecutorTest.java</exclude>
+          </excludes>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.modello</groupId>
+        <artifactId>modello-maven-plugin</artifactId>
+        <version>1.1</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>xpp3-reader</goal>
+              <goal>java</goal>
+              <goal>xpp3-writer</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <version>2.0.0</version>
+          <packageWithVersion>false</packageWithVersion>
+          <models>
+            <model>src/main/mdo/release-descriptor.mdo</model>
+          </models>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.plexus</groupId>
+        <artifactId>plexus-maven-plugin</artifactId>
+        <version>1.3.8</version>
+        <executions>
+          <execution>
+            <id>create-component-descriptor</id>
+            <phase>generate-resources</phase>
+            <goals>
+              <goal>descriptor</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>merge</id>
+            <configuration>
+              <output>${project.build.outputDirectory}/META-INF/plexus/components.xml</output>
+              <descriptors>
+                <descriptor>${project.build.outputDirectory}/META-INF/plexus/components.xml</descriptor>
+                <descriptor>src/main/components-fragment.xml</descriptor>
+              </descriptors>
+            </configuration>
+            <phase>process-resources</phase>
+            <goals>
+              <goal>merge-descriptors</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
Index: maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RunPerformGoalsPhase.java
===================================================================
--- maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RunPerformGoalsPhase.java	(Revision 986305)
+++ maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RunPerformGoalsPhase.java	(Arbeitskopie)
@@ -23,6 +23,7 @@
 import org.apache.maven.shared.release.ReleaseResult;
 import org.apache.maven.shared.release.config.ReleaseDescriptor;
 import org.apache.maven.shared.release.env.ReleaseEnvironment;
+import org.apache.maven.shared.release.util.PomFinder;
 import org.codehaus.plexus.util.StringUtils;
 
 import java.io.File;
@@ -64,6 +65,33 @@
             additionalArguments = "-f pom.xml";
         }
 
+        String workDir = releaseDescriptor.getWorkingDirectory();
+        if ( workDir == null)
+        {
+            workDir = System.getProperty("user.dir");
+        }
+
+        String pomFileName = releaseDescriptor.getPomFileName();
+        if ( pomFileName == null )
+        {
+            pomFileName = "pom.xml";
+        }
+
+        File pomFile = new File( workDir, pomFileName );
+        PomFinder pomFinder = new PomFinder( getLogger() );
+        boolean foundPom = pomFinder.parsePom( pomFile );
+
+        if ( foundPom )
+        {
+            File matchingPom = pomFinder.findMatchingPom( new File( releaseDescriptor.getCheckoutDirectory() ) );
+            if ( matchingPom != null )
+            {
+                getLogger().info( "Invoking perform goals in directory " + matchingPom.getParent() );
+                releaseDescriptor.setCheckoutDirectory( matchingPom.getParent() );
+            }
+
+        }
+
         return execute( releaseDescriptor, releaseEnvironment, new File( releaseDescriptor.getCheckoutDirectory() ), additionalArguments );
     }
 
Index: maven-release-manager/src/main/java/org/apache/maven/shared/release/util/PomFinder.java
===================================================================
--- maven-release-manager/src/main/java/org/apache/maven/shared/release/util/PomFinder.java	(Revision 0)
+++ maven-release-manager/src/main/java/org/apache/maven/shared/release/util/PomFinder.java	(Revision 0)
@@ -0,0 +1,316 @@
+package org.apache.maven.shared.release.util;
+
+/*
+ * 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 org.apache.maven.model.Model;
+import org.apache.maven.model.Parent;
+import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+
+
+/**
+ * <p>This utility class helps with finding a maven pom file
+ * which got parsed previously. It uses the fact that the
+ * combination of any parent ids plus the ids of the current
+ * pom itself is unique.</p>
+ *
+ * <h3>Usage:</h3>
+ * <ol>
+ *   <li>
+ *     Parse a pom in a given directory with {@link #parsePom(java.io.File)}
+ *     This will act as the information what to search for.
+ *   </li>
+ *   <li>
+ *      Search for the matching pom in a given tree using
+ *      {@link #findMatchingPom(java.io.File)}
+ *   </li>
+ * </ol>
+ *
+ * @author <a href="mailto:struberg@yahoo.de">Mark Struberg</a>
+ */
+public class PomFinder
+{
+
+    private Logger log;
+    private PomInfo foundPomInfo;
+
+    public PomFinder(Logger log)
+    {
+        this.log = log;
+    }
+
+    /**
+     *
+     * @param originPom the pom File which should be used as blueprint for the search
+     * @return <code>true</code> if a pom got parsed successfully, <code>false</code> otherwise
+     */
+    public boolean parsePom(File originPom)
+    {
+        if ( !originPom.exists() )
+        {
+          return false;
+        }
+
+        try
+        {
+            foundPomInfo = readPomInfo(originPom);
+        }
+        catch (IOException e)
+        {
+            log.error("Error while parsing pom file", e);
+            return false;
+        }
+        catch (XmlPullParserException e)
+        {
+            log.error("Error while parsing pom file", e);
+            return false;
+        }
+
+        return foundPomInfo != null;
+    }
+
+    /**
+     * Search for the previously with {@link #parsePom(java.io.File)}
+     * parsed pom in the given directory.
+     * @param startDirectory
+     * @return the pom file which matches the previously parsed pom or <code>null</code> if nothing found
+     */
+    public File findMatchingPom( File startDirectory )
+    {
+        if ( !startDirectory.exists() )
+        {
+            return null;
+        }
+
+        if ( !startDirectory.isDirectory() )
+        {
+            log.error("PomFinder must be started with a directory! Got " + startDirectory.getAbsolutePath() );
+            return null;
+        }
+
+        if ( foundPomInfo == null)
+        {
+            log.error( "Please run parsePom first!" );
+            return null;
+        }
+
+        // look for the file in the current directory
+        File matchingPom = new File( startDirectory, foundPomInfo.getFileName() );
+        if ( matchingPom.exists() )
+        {
+            PomInfo pi = null;
+            try
+            {
+                pi = readPomInfo( matchingPom );
+            }
+            catch (IOException e)
+            {
+                log.error( "Error while parsing pom file", e);
+                return null;
+            }
+            catch (XmlPullParserException e)
+            {
+                log.error( "Error while parsing pom file", e);
+                return null;
+            }
+            
+            if  ( pi == null || !pi.equals( foundPomInfo ) )
+            {
+                matchingPom = null;
+            }
+        }
+        else
+        {
+            matchingPom = null;
+        }
+
+        if ( matchingPom == null )
+        {
+            String[] childFiles = startDirectory.list();
+            for ( int i = 0; i < childFiles.length; i++ )
+            {
+                String childFile = childFiles[ i ];
+                
+                File subDir = new File( startDirectory, childFile );
+                if ( subDir.isDirectory() && !subDir.isHidden() )
+                {
+                    matchingPom = findMatchingPom( subDir );
+                }
+                
+                if ( matchingPom != null )
+                {
+                    break;
+                }
+            }
+        }
+
+
+        return matchingPom;
+    }
+
+
+    /**
+     * Read the {@link PomInfo} from the given pom file
+     * @param pomFile pom.xml file
+     * @return the PomInfo or <code>null</code
+     */
+    private PomInfo readPomInfo(File pomFile)
+            throws IOException, XmlPullParserException
+    {
+        if ( !pomFile.exists() || !pomFile.isFile() )
+        {
+            return null;
+        }
+        
+        PomInfo pomInfo = null;
+
+        MavenXpp3Reader reader = new MavenXpp3Reader();
+        Model model = reader.read( new InputStreamReader( new FileInputStream( pomFile ), "utf-8" ) );
+        if ( model != null )
+        {
+            pomInfo = new PomInfo();
+            pomInfo.setArtifactId( model.getArtifactId() );
+            pomInfo.setGroupId( model.getGroupId() );
+
+            Parent parent = model.getParent();
+            if ( parent != null )
+            {
+                pomInfo.setParentArtifactId( parent.getArtifactId() );
+                pomInfo.setParentGroupId( parent.getGroupId() );
+            }
+
+            pomInfo.setFileName( pomFile.getName() );
+        }
+        return pomInfo;
+    }
+
+    /***
+     * Data container which helds information about a pom.
+     * Information may partially be empty.
+     */
+    private static class PomInfo
+    {
+        private String fileName;
+        private String artifactId;
+        private String groupId;
+        private String parentArtifactId;
+        private String parentGroupId;
+
+        public String getFileName()
+        {
+            return fileName;
+        }
+
+        public void setFileName( String fileName )
+        {
+            this.fileName = fileName;
+        }
+
+        public String getArtifactId()
+        {
+            return artifactId;
+        }
+
+        public void setArtifactId( String artifactId )
+        {
+            this.artifactId = artifactId;
+        }
+
+        public String getGroupId()
+        {
+            return groupId;
+        }
+
+        public void setGroupId( String groupId )
+        {
+            this.groupId = groupId;
+        }
+
+        public String getParentArtifactId()
+        {
+            return parentArtifactId;
+        }
+
+        public void setParentArtifactId( String parentArtifactId )
+        {
+            this.parentArtifactId = parentArtifactId;
+        }
+
+        public String getParentGroupId()
+        {
+            return parentGroupId;
+        }
+
+        public void setParentGroupId( String parentGroupId )
+        {
+            this.parentGroupId = parentGroupId;
+        }
+
+        public boolean equals(Object o)
+        {
+            if ( this == o )
+            {
+                return true;
+            }
+
+            if ( o == null || getClass() != o.getClass() )
+            {
+                return false;
+            }
+
+            PomInfo pomInfo = (PomInfo) o;
+
+            if ( artifactId != null ? !artifactId.equals( pomInfo.artifactId ) : pomInfo.artifactId != null)
+            {
+                return false;
+            }
+            if ( groupId != null ? !groupId.equals( pomInfo.groupId ) : pomInfo.groupId != null )
+            {
+                return false;
+            }
+            if ( parentArtifactId != null ? !parentArtifactId.equals( pomInfo.parentArtifactId ) : pomInfo.parentArtifactId != null )
+            {
+                return false;
+            }
+            if ( parentGroupId != null ? !parentGroupId.equals( pomInfo.parentGroupId ) : pomInfo.parentGroupId != null )
+            {
+                return false;
+            }
+
+            return true;
+        }
+
+        public int hashCode()
+        {
+            int result = artifactId != null ? artifactId.hashCode() : 0;
+            result = 31 * result + (groupId != null ? groupId.hashCode() : 0);
+            result = 31 * result + (parentArtifactId != null ? parentArtifactId.hashCode() : 0);
+            result = 31 * result + (parentGroupId != null ? parentGroupId.hashCode() : 0);
+            return result;
+        }
+    }
+}
