How to remove postfix _ w60> -version> from artifacts created by + published using a simple build tool?

I am creating several Java-only projects using a simple build tool. When I publish artifacts from projects using, say, sbt publish-local, then the resulting artifacts have a Scala version added to their name. With the Scala project, this makes sense, but since it is only Java projects, it is not. How to disable this postfix version of Scala? Or can I?

For reference, I use sbt 0.11.1, Scala 2.9.1 and the .sbt file to configure the assembly (although switching to the full project configuration will not be a problem).

+60
scala sbt
Nov 27 2018-11-11T00:
source share
4 answers

After seeing how Artifact.artifactName is implemented and ultimately used, it seems like a way to disable this is to specify false for the crossPath parameter. This is described in one quick configuration example on the xsbt wiki.

http://www.scala-sbt.org/release/docs/Examples/Quick-Configuration-Examples

// disable using the Scala version in output paths and artifacts crossPaths := false 
+80
Nov 28 2018-11-11T00:
source share

This is described on the xsbt wiki in the section Changing default artifacts . From this page:

For example, to create a minimum name without a classifier or cross path:

 artifactName := { (sv: ScalaVersion, module: ModuleID, artifact: Artifact) => artifact.name + "-" + module.revision + "." + artifact.extension } 
+8
Nov 27 '11 at 23:05
source share

While the accepted answer is strictly correct, you should never set crossVersions to false publicly published Scala artifacts. The built-in version of Scala is an important compatibility feature, since different versions of Scala libraries may not be compatible with binary files.

Set only crossVersions to false for projects, as in the question, which are strictly intended only for Java.

+2
Feb 02 '14 at 20:00
source share

I know this question is old, but I asked myself the same question, and actually a very simple way to do it now. All you have to do is declare the dependency using % instead of %% :

%: method used to create the Ivy module identifier from the strings you supply.

%%: when used after groupID, your Scala projects (for example, _2.10) are automatically added to the end of the artifact name.

http://alvinalexander.com/scala/sbt-how-to-manage-project-dependencies-in-scala

+2
Jul 14 '17 at 15:04
source share



All Articles