Warn about scala binary version suffix on dependencies
See original GitHub issueThe @@dependency
directive renders sbt
/Maven/Gradle/… snippets to easily copy paste a library dependency on the users build code.
The dependencies usually include a scala.binary.version
suffix which can lead users unfamiliar with the scala ecosystem to mixing artifacts such as akka-actor_2.13
and akka-testkit_2.12
which leads to obscure errors (e.g. noclassdeffounderror scala/serializable
).
The @@dependency
could, instead, not set the scala.binary.version
to a given value and use a build-specific placeholder (e.g. Maven property
) with a small comment similar to the support to symbol/value in:
@@dependency [Maven,sbt,Gradle] {
group=com.typesafe.akka
artifact=akka-stream-kafka-testkit_$scala.binary.version$
version=$project.version$
scope=test
symbol2=AkkaVersion
value2="$akka.version$"
group2=com.typesafe.akka
artifact2=akka-stream-testkit_$scala.binary.version$
version2=AkkaVersion
scope2=test
}
rendering as
<properties>
<akka.version>2.5.23</akka.version>
</properties>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-stream-kafka-testkit_2.12</artifactId>
<version>2.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-stream-testkit_2.12</artifactId>
<version>${akka.version}</version>
<scope>test</scope>
</dependency>
But such that any paradox user gets the symbol/value usage out fo the box (instead fo copy/pasting it every single time).
This came up during a gitter discussion.
So, a paradox user simply adding:
@@dependency [Maven,sbt,Gradle] {
group=com.typesafe.akka
artifact=akka-stream-kafka-testkit_$scala.binary.version$
version=$project.version$
scope=test
}
would get the following maven snippet for free:
<properties>
<scala.binary.version>2.5.23</scala.binary.version>
</properties>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-stream-kafka-testkit_${scala.binary.version}</artifactId>
<version>2.0.2</version>
<scope>test</scope>
</dependency>
Optionally with a comment:
<properties>
<!-- All your artifacts must be compiled to the same scala.binary.version (TODO: adda link here to some relevant documentation in scala-lang.org ?)-->
<scala.binary.version>2.5.23</scala.binary.version>
</properties>
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
Top GitHub Comments
I looked into this. My plan would be to enable this automatically as soon as an artefact name uses
$scala.binary.version$
.Implemented with #429