Historically I have used Ant+Ivy or Maven for building my Java projects. I'm now looking at non-xml based solutions.
Gradle can compile, jar and publish my project with few issues.
Can I do the same with SBT? If so, can you provide a simple example of using sbt to build a java only project.
sbt has support for compiling Java sources with the limitation that dependency tracking is limited to the dependencies present in compiled class files.
sbt is an open-source build tool for Scala and Java projects, similar to Apache's Maven and Ant. Its main features are: Native support for compiling Scala code and integrating with many Scala test frameworks. Continuous compilation, testing, and deployment.
For sbt users, JDK 11 support requires minimum sbt version 1.1. 0. sbt 1.3.
For me, it also helped a bit to remove the scala version information from the generated artifact paths, as described in this answer. You'll also want to remove the Scala library as a dependency from any pom or ivy file you publish.
Here's what you'll need:
crossPaths := false autoScalaLibrary := false
Yes this is entirely possible. Nothing to setup really, a small build.sbt file should do the trick, something like:
organization := "your.group.id" name := "Your project" version := "1.0-SNAPSHOT" libraryDependencies ++= Seq( <any normal jar deps> )
And run sbt package
from the command line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With