0

How can I access a private maven Repository at Gitlab during my java build in an azure pipeline that has a dependency to a jar file in the repo at Gitlab?

There is this MavenAuthenticateV0 task but that expect the maven config to be in the following format:

<server>
    <id>feedName</id>
    <username>Authorization</username>
    <password>token</password>
</server>

While Gitab expects:

<server>
  <id>feedName</id>
  <configuration>
    <httpHeaders>
      <property>
        <name>Authorization</name>
        <value>token</value>
      </property>
    </httpHeaders>
  </configuration>
</server>

How to solve this?

edbras
  • 4,145
  • 9
  • 41
  • 78
  • 1
    Does the MavenAuthenticateV0 task not work? Does replacing Gitlab expects format into setting.xml work? You can try to specify setting.xml in the option argument of maven task: `options: '--settings .mvn/settings.xml'`. Here is the [case](https://github.com/MicrosoftDocs/azure-devops-docs/issues/333) you can refer to. – Hugh Lin Mar 01 '21 at 09:40
  • Thanks @HughLin-MSFT, I wasn't aware of this option, I will play with it and let you know if it works for me – edbras Mar 01 '21 at 21:20
  • I think it seems to work, just fighting with the credentials, but it seems to work, thanks – edbras Mar 02 '21 at 13:06
  • Glad to hear that this workaround works, I will convert the comment to an answer. If this answer is helpful, you could consider to accept it. Thanks. Have a nice day. :) – Hugh Lin Mar 04 '21 at 01:52

1 Answers1

1

As a workaround , you can try to specify setting.xml in the option argument of maven task:

- task: Maven@1
  inputs:
    mavenPomFile: 'pom.xml'
    goals: deploy
    options: '--settings .mvn/settings.xml'

Here is a ticket you can refer to.

Hugh Lin
  • 17,829
  • 2
  • 21
  • 25