Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mvn release:perform fails because pom file is not at root of repository

I am trying to execute mvn release:perform, but the command assumes that the pom file is at the root of the repository. Is there a system property or preference that I can set to override the default?

The call to mvn release:prepare seems to have succeeded as all the release artifacts are sitting in the target directory and the repository is properly tagged.

In case it matters, this is a git project.


EDIT Here is what I did:

cd /path/to/git/root/path/to/mvn/project
mvn -DdevelopmentVersion=1.2.0-SNAPSHOT -DreleaseVersion=1.1.0 release:prepare
...enter correct passphrase and choose all default options...
mvn release:perform

And then cloning the remote repo in the target/checkout directory and after some churning and pushing to the remote git repo, the following error happens:

[ERROR]   
[ERROR]   The project  (/path/to/git/root/path/to/mvn/project/target/checkout/pom.xml) has 1 error
[ERROR]     Non-readable POM /path/to/git/root/path/to/mvn/project/target/checkout/pom.xml: /path/to/git/root/path/to/mvn/project/target/checkout/pom.xml (No such file or directory)

So, maven is looking for the pom file in the root of the target/checkout directory, which is not where it is located.

like image 975
Andrew Eisenberg Avatar asked Jul 03 '13 22:07

Andrew Eisenberg


1 Answers

I had the same problem. Add this to your pom:

<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>

Source: https://stackoverflow.com/a/8233712/555220

like image 103
Fedy2 Avatar answered May 22 '23 07:05

Fedy2