SBT does not send Authorization header to Nexus after adding artifact

Viewed 96

I have a project in Scala where I build a fat-jar using sbt-assembly plugin. The artifact is configured and added like this:

artifact in (Compile, assembly) := {
  val art = (artifact in (Compile, assembly)).value
  art.withClassifier(Some("assembly"))
}

addArtifact(artifact in (Compile, assembly), assembly)

There are also settings for Nexus repository and it's credentials. It fails. I sniffed the packets with wireshark and it turned out SBT is not sending Authorization header to Nexus.

I can upload the fat-jar by hand e.g. from Postman and it works.

It also works when I remove the addArtifact... setting.

When it works, Authorization header is there (checked with Wireshark). But it's missing when the artifact is added.

SBT version: 1.4.1 (but I also tried 1.4.0 and 1.3.14)

EDIT:

Here is a repo on github where you can observe this behavior: https://github.com/amorfis/sbt-assembly-publish-error

It's necessary to enter Nexus address and credentials in project/Nexus.scala

0 Answers
Related