1
votes

my problem happens during a maven release with such a command :

mvn --settings D:\My\user_settings.xml release:prepare release:perform -Dresume=false -Darguments="-DskipTests" -Prelease

The project tree is set this way (and cannot be changed!) :

  • project\project\pom.xml
  • project\project-core\pom.xml
  • project\project-service\pom.xml
  • project\project-encrypt\pom.xml

And in the parent pom, you have (along with other things indeed!) :

<modules>
    <module>..//project-encrypt</module>
    <module>..//project-core</module>
    <module>..//project-service</module>
</modules>

Maven build goes well, but when it is time to perform a git-add, I got this message :

Executing: cmd.exe /X /C "git add -- pom.xml -encrypt\pom.xml -core\pom.xml -service\pom.xml" Working directory: D:\My\Workspaces\project\project

Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare (default-cli) on project project: Unable to commit files Provider message: The git-add command failed. Command output: fatal: pathspec '-encrypt\pom.xml' did not match any files

I've tried to write the modules path many ways, but all failed the same way :

..//project-encrypt

../project-encrypt

../project-encrypt

Any idea about this problem? (Since I cannot rename my projects, this is actually not a solution...).

Thanks in advance for reading until here!

1

1 Answers

0
votes

At first, you should describe relative path to parent pom.xml in all modules

<parent>
    <groupId>com.mycompany.app</groupId>
    <artifactId>...</artifactId>
    <version>...</version>
    <relativePath>../project/pom.xml</relativePath> <!-- REQUIRED! -->
</parent>

The second, you should add fake project/pom.xml with (a) distribution section and (b) modules description section:

<modules>
    <module>project</module>
    <module>project-core</module>
    <module>project-service</module>
    <module>project-encrypt</module>
</modules>

Now, you can release this project, it will make a trick.

BTW, replace // with single / in paths. Windows may interprete double slashes as network path.