'sbt publish assembly jar with a pom

I am able to build one of my multi-project's jars as a single jar and then publish it How do I publish a fat JAR (JAR with dependencies) using sbt and sbt-release?

However, the associated pom.xml is not published with it.

How can I create and publish the pom.xml (and ivy file) descriptors for an sbt-assembly jar?

My project is lions-share.



Solution 1:[1]

Do you need to publish the contents of an existing pom.xml file, or can you let sbt generate the pom's contents for you? If the latter, consider using pomExtra:

pomExtra := (
  <url>http://jsuereth.com/scala-arm</url>
  <licenses>
    <license>
      <name>BSD-style</name>
      <url>http://www.opensource.org/licenses/bsd-license.php</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <scm>
    <url>[email protected]:jsuereth/scala-arm.git</url>
    <connection>scm:git:[email protected]:jsuereth/scala-arm.git</connection>
  </scm>
  <developers>
    <developer>
      <id>jsuereth</id>
      <name>Josh Suereth</name>
      <url>http://jsuereth.com</url>
    </developer>
  </developers>)

Solution 2:[2]

If you are making your fat jar via sbt clean assembly and want to include .pom with the jar, use sbt clean makePom assembly. This will automatically create the .pom file with the .jar file

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 earldouglas
Solution 2 Sajal