Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

With mvn release:prepare, is it possible to instruct Maven to use a forward slash in the submodule pom locations for the commit command?

Using Maven 3.0.5 on a Windows box, I'm trying to run mvn -X -B release:prepare from a Cygwin bash prompt, which fails. Here's some of the output:

[INFO] Executing: cmd.exe /X /C "git commit --verbose -F C:\cygwin\tmp\maven-scm-24643703.commit pom.xml module1\pom.xml module2\pom.xml"

...

[ERROR] The git-commit command failed.
[ERROR] Command output:
[ERROR] error: pathspec '"module1\\pom.xml"' did not match any file(s) known to git.
[ERROR] error: pathspec '"module2\\pom.xml"' did not match any file(s) known to git.

If I run the command manually (from a bash prompt) after modifying the backslashes to forward slashes, it works:

cmd.exe /X /C "git commit --verbose pom.xml module1/pom.xml module2/pom.xml"

I've tried modifying the root pom to make it happen automatically:

<properties>
    <file.separator>/</file.separator>
    <fileSeparator>/</fileSeparator>
</properties>

I've tried various options on the command line:

-Darguments="-DfileSeparator=/"
-Darguments="-Dfile.separator=/"
-DfileSeparator='/'

Is there a way to instruct Maven to use a forward slash in the submodule pom locations for the commit command?

EDIT:

Built Maven from source, locally under Cygwin. Created an example project from an archetype with two submodules. Repeated the mvn -B release:prepare with the same result as before:

[INFO] [INFO] BUILD SUCCESS
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time: 3.316s
[INFO] [INFO] Finished at: Fri Jun 28 14:29:53 CDT 2013
[INFO] [INFO] Final Memory: 19M/223M
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] Checking in modified POMs...
[INFO] Executing: cmd.exe /X /C "git add -- pom.xml module1\pom.xml module2\pom.xml"
[INFO] Working directory: C:\cygwin\home\don.branson\projects\example
[INFO] Executing: cmd.exe /X /C "git status"
[INFO] Working directory: C:\cygwin\home\don.branson\projects\example
[INFO] Executing: cmd.exe /X /C "git commit --verbose -F C:\cygwin\tmp\maven-scm-1306363489.commit pom.xml module1\pom.xml
module2\pom.xml"
[INFO] Working directory: C:\cygwin\home\don.branson\projects\example
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] example ........................................... FAILURE [6.972s]
[INFO] module1 ........................................... SKIPPED
[INFO] module2 ........................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.475s
[INFO] Finished at: Fri Jun 28 14:29:54 CDT 2013
[INFO] Final Memory: 8M/153M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.0:prepare (default-cli) on project example:
Unable to commit files
[ERROR] Provider message:
[ERROR] The git-commit command failed.
[ERROR] Command output:
[ERROR] error: pathspec '"module1\\pom.xml"' did not match any file(s) known to git.
[ERROR] error: pathspec '"module2\\pom.xml"' did not match any file(s) known to git.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Here's the root pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.example</groupId>
  <artifactId>example</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>pom</packaging>

  <name>example</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <scm>
    <connection>scm:git:file://../example.git/</connection>
  </scm>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <modules>
    <module>module1</module>
    <module>module2</module>
  </modules>
</project>

Here's module1's pom.xml:

<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>com.example</groupId>
    <artifactId>example</artifactId>
    <version>1.0-SNAPSHOT</version>
  </parent>
  <groupId>com.example</groupId>
  <artifactId>module1</artifactId>
  <version>1.0-SNAPSHOT</version>
  <name>module1</name>
  <url>http://maven.apache.org</url>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>

EDIT:

Here's a guy with the same issue. His solution is to use the windows shell instead of bash. Bleh:

http://www.theroundmeatball.com/making-maven-release-plugin-on-windows-with-git-gpg-and-github-to-work/

like image 559
Don Branson Avatar asked Oct 21 '22 06:10

Don Branson


1 Answers

I worked around it by just executing the git command manually.

The Maven message says what it tried to execute, I executed exactly this command manually, correcting the slashes.

Then I rerun maven and got the second git command that will also fail.

I also did this manually and rerun maven a last time.

It is not nice, but at least it is a manual work-around.

like image 187
Vampire Avatar answered Oct 24 '22 02:10

Vampire