11

I've got a git repo where the top level directory has three directories in it: java, COM, and csharp. As you might guess, the pom.xml lives in the java directory.

All is well until I go to run the release plugin. It clones the entire repo into target/checkout, and then expects the pom to be right there at the top. It ain't. End of story.

Can I tell the release plugin about the extra directory, or do I have to split the repro?

bmargulies
  • 97,814
  • 39
  • 186
  • 310

2 Answers2

20

Tested: add the following to your build/plugins section:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-release-plugin</artifactId>
    <version>2.2.1</version>
    <executions>
        <execution>
            <id>default</id>
            <goals>
                <goal>perform</goal>
            </goals>
            <configuration>
                <pomFileName>subdir/pom.xml</pomFileName>
            </configuration>
        </execution>
    </executions>
</plugin>

Where "subdir" is the relative path to the directory where the pom.xml resides.

This works, at least with Maven 3.0.3. May work with different release plugin versions, but this is untested.

This works with Maven 3.0.4 and maven-release-plugin 2.5 and git 1.8.x.

bmargulies
  • 97,814
  • 39
  • 186
  • 310
sunspot
  • 315
  • 4
  • 5
  • Works also on Maven 2.2.1 (with maven-release-plugin:2.2.1). But why do we have to define the `pomFileName` under `executions` hierarchy and not directly under `configuration`. Awfully lots of stuff there for single line of configuration? – Tuukka Mustonen Dec 07 '11 at 14:49
  • Well, the reason I put it under `executions` was to target the configuration to the specific goal. If you're sure it won't interfere with other goals, it would probably work directly in `configuration`. – sunspot Dec 20 '11 at 18:40
  • Whilst this appears to work with maven 3.0.4, it doesn't commit changes to Git repository. Using the latest release plugin does commit changes, but doesn't recognise the pomFileName configuration. – fortuna Jun 09 '15 at 05:55
2

Perfoming release didn't deploy properly in not-root directory with maven-release-plugin version 2.4 (with both maven 3.0.3 and 3.0.4). Downgrading to maven-release-plugin version 2.2.1 fixed the problem.