1
votes

On an Android project named foobar I run mvn release:prepare which successfully builds the application and adds a local commit to the Git repository. Then when the script tries to push to the remote repository the following error occurs:

[ERROR] Failed to execute goal org.apache.maven.plugins:\
        maven-release-plugin:2.4.1:prepare (default-cli) on project foobar: \
        Unable to commit files
[ERROR] Provider message:
[ERROR] The git-push command failed.
[ERROR] Command output:
[ERROR] fatal: unable to connect to :
[ERROR] : Name or service not known

I use public/private keys to access a local server named mylocalserver:

# ~/.ssh/config
Host mylocalserver-git
    HostName 192.168.100.100
    User git
    IdentityFile ~/.ssh/id_rsa

The Git configuration refers to the hostname and points to the repository:

# Git config
remote.mylocalserver.url=git@mylocalserver-git:foobar.git

Maven also knows about the server:

<!-- pom.xml -->
<scm>
    <developerConnection>
        scm:git:git://mylocalserver-git:foobar.git
    </developerConnection>
</scm>

The directory structure of the project is as follows:

├── .git
├── .settings
├── assets
├── bin
├── docs
├── gen
├── gen-external-apklibs
├── libs
├── out
├── res
├── src
├── target
├── tmp
├── .classpath
├── .gitignore
├── .project
├── AndroidManifest.xml
├── ic_launcher-web.png
├── pom.xml
├── proguard.cfg
├── project.properties
├── README

I can use the remote server with any Git command such as git push mylocalserver master. Why is Maven failing though?
I can suppress the error when I prohibit maven to push the release:

1

1 Answers

1
votes

Check the accepted syntax for Maven Git SCM. Your:

scm:git:git://mylocalserver-git:foobar.git

should be:

scm:git:git://mylocalserver-git/foobar.git