Using Maven git-commit-id-plugin in Pipelines

Hello!

I'm trying to run my maven build script in Pipelines, but it fails with this error message:

 

 

[ERROR] Failed to execute goal pl.project13.maven:git-commit-id-plugin:2.2.1:revision (default) on project omc-server: Could not complete Mojo execution... java.net.URISyntaxException: Illegal character in authority at index 8: https://x-token-auth:{access_token}@bitbucket.org/imavis/omc.git -> [Help 1]

any ideas?

Thanks for yout help!

4 answers

1 accepted

This widget could not be displayed.

Hi Aldo,

It looks like you're using a maven plugin (git-commit-id-plugin) that requires a valid origin url in your local git configuration.

If this is not an essential plugin for your build then the easiest way to fix the issue is to disable the plugin (perhaps move the plugin into a maven profile that is not enabled when your build is run in Pipelines).

If it is an essential plugin then you'll need to set a valid origin url and probably set up ssh authentication so that your build can communicate with the remote repository.

Initially I would try just setting a valid origin url at the beginning of your script:

git remote set-url origin https://bitbucket.org/imavis/omc.git

However there's a good chance this still won't work if the plugin needs to actually communicate with the remote server. It may fail with an authentication error or the build may hang waiting for user input (be sure to watch the build and stop it manually if it hangs).

If that doesn't work then you'll need to set an ssh-based origin url and also set up ssh authentication.

The ssh-based url will look something like this:

git remote set-url origin git@bitbucket.org:imavis/omc.git

And the following guides describe how to set up ssh authentication:

https://answers.atlassian.com/questions/39429257

https://answers.atlassian.com/questions/39243415

cheers,

Steven

 

Thank you very much: I just needed to retrieve the local commit id, so simply setting the origin url did the trick.

Yes, thank you. This solved the problem for us as well.

This widget could not be displayed.

Would you be able to paste in the contents of your bitbucket-pipelines.yml? 

This widget could not be displayed.

I'm using the unmodified standard template for a maven project:

# This is a sample build configuration for Maven.
# Check our guides at https://confluence.atlassian.com/x/VYk8Lw for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: maven:3.3.3
pipelines:
  default:
    - step:
        script: # Modify the commands below to build your repository.
          - mvn clean install
This widget could not be displayed.

Hi Aldo,
This looks like it's probably caused by an error as a result of a plugin overriding a default lifecycle hook in your pom.xml. I'd recommend trying to mount and run the build on a local docker container to see whether it works and start debugging. If there are still problems please raise an issue at https://support.atlassian.com/ so we can investigate further.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 21, 2018 in Bitbucket

Branch Management with Bitbucket

As a project manager, I have discovered that different developers want to bring their previous branching method with them when they join the team. Some developers are used to performing individual wo...

1,306 views 8 11
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you