sbt: Add http headers when fetching private maven repo with credentials

1.1k Views Asked by At

I try to use credentials in my build.sbt config in order to retrieve private artifacts from a gitlab private maven repository.

But as sbt documentation states :

The credentials file is a properties file with keys realm, host, user, and password.

And gitab private maven documentation states :

If a project is private or you want to upload Maven artifacts to GitLab, credentials will need to be provided for authorization. Support is available for personal access tokens and CI job tokens only. Deploy tokens and regular username/password credentials do not work.

The only way to authenticate when fetching or pushing artifacts to gitlab maven private repository is to use a maven settings.xml file with :

<settings>
  <servers>
    <server>
      <id>gitlab-maven</id>
      <configuration>
        <httpHeaders>
          <property>
            <name>Private-Token</name>
            <value>REPLACE_WITH_YOUR_PERSONAL_ACCESS_TOKEN</value>
          </property>
        </httpHeaders>
      </configuration>
    </server>
  </servers>
</settings>

I found a workaround to push my private artifacts (intermediate step locally) but I am out of options to use these private artifacts as libraryDependencies in other scala repositories.

  • Is there anyway to have sbt fetching my private gitlab repository with the required httpHeaders ?
  • Do you know any workaround (multi-step fetchs) to have my private artifacts retrieved ?
0

There are 0 best solutions below