sbt-native-packager icon indicating copy to clipboard operation
sbt-native-packager copied to clipboard

PublishLocal not using cross-version suffix.

Open mai00cmi opened this issue 11 years ago • 5 comments

I'm using following settings in my build.sbt

SbtNativePackager.packageArchetype.java_application

SbtNativePackager.deploymentSettings

publishLocal <<= publishLocal.dependsOn(publishLocal in config("universal"))

and while publishLocal publishes the jar file, -javadoc.jar -sources.jar with the cross-version suffix _2.10 the zip file and tgz file are published without the cross-version suffix.

mai00cmi avatar Oct 27 '14 16:10 mai00cmi

I've run into the same problem and temporarily set this in my build.sbt to get the expected behavior:

name in Universal := name.value + "_" + CrossVersionUtil.binaryScalaVersion(scalaVersion.value),
moduleID in Universal := organization.value %% (name in Compile).value % version.value,

rafikk avatar Jan 18 '15 21:01 rafikk

Same behavior to publish into remote and local maven repository. (sbt 1.2.8) As example, involking:

sbt +rpm/publishM2

I had to change:

Rpm / target := (if (crossPaths.value) crossTarget.value else target.value)  / "rpm",
Rpm / name += (if (crossPaths.value) "_" + scalaBinaryVersion.value else ""),
Rpm / moduleID := organization.value %% (Rpm / name).value % version.value,

giorgioinf avatar Jul 10 '19 14:07 giorgioinf

Can you explain the use case for this? I'm not sure why you would want to cross build an application? This makes sense for libraries IMHO.

muuki88 avatar Jul 10 '19 14:07 muuki88

The Apache Spark is moving from 2.11 to scala 2.12, but I have to keep the compatibility with both scala versions.

In general terms, when we have an application which depends on the environment's particular scala version jars.

The user can chose one or another based on his environment's scala version.

The another approach, which could avoid building multiple applications, consists in splitting the module into a launcher (rpm,deb...) and the library jars, where the launcher would choose one or another.

For now, the first approach is quick for me, but the second would be more likely.

giorgioinf avatar Jul 10 '19 15:07 giorgioinf

Thanks for the clarification @giorgioinf . I should have known that the answer is spark :joy: Interesting to know that you deploy spark applications as rpm/deb.

I'm willing to merge a pull request if this is implemented in native-packager. As this is rather uncommon use case, it would be nice to have this hidden in either an AutoPlugin or a general setting. I would prefer the AutoPlugin option (e.g. CrossPublishPackages)

muuki88 avatar Jul 10 '19 15:07 muuki88