Run SBT without installing it first - sbt

I was wondering if SBT has something similar to the Gradle Wrapper?
I would like to use it on a CI server without having to install SBT first.
The documentation mentions a sbt-launcher, but that seems to be geared towards running actual application instead of builds.

Yes, sbt-extras is a bash script that you can commit to your repository to act like the gradle wrapper.

The sbt-extras project is centered around a stand-alone script called sbt which can be directly used to run sbt without having it on the machine first.
The script has logic to determine the proper version of sbt for the project, download the correct version of the sbt jar, and then run the tasks through sbt.
If you copy the sbt script into your project, you can simply call it — from your CI server, locally, or wherever — to run sbt tasks without needing sbt installed separately.

Related

Which concourse resource should be used to execute grunt commands

I have UI project which is using GRUNT to perform build and tests. When I try to invoke tests within concourse task which resource image I should use where grunt is already installed. I am getting this below error now.
/bin/bash: line 4: grunt: command not found
You can use any OCI-compatible image that has grunt preinstalled. Alternatively, make your own image and push it to a repository like dockerhub. As yet another alternative you could use a base image for your task and install grunt every time (though this is slower).
TLDR: Concourse does not provide task images and you need to use your own.

Migrate from activator 0.13.x to sbt 1.x

I am migrating from activator from 0.13.x to sbt 1.x.
I used to compile my modules like this $ activator clean compile publish-local -Dversion=1
Now, I am trying to do it with sbt since activator has been deprecated, but I can not find how I should migrate to something similar like $ sbt clean compile publish-local -Dversion=1?
Activator (the CLI part) was just a wrapper around sbt with some custom commands. So what you wrote should work the same, expect that the snake-case was deprecated in favor of the camelCase:
sbt clean compile publishLocal
If you need to pass a var to the Java runtime with -D you have to place it before any commands: sbt -Dversion=1 ....
Notice that you use batch mode to run the commands:
Running in batch mode requires JVM spinup and JIT each time, so your build will run much slower. For day-to-day coding, we recommend using the sbt shell or Continuous build and test feature described below.
To follow this recommendation, just run sbt and then enter those commands one by one. Or to run them all sequentially, enter ; clean; compile; publishLocal.

sbt hanging on process which runs on another computer

sbt works fine for one project on this computer but does not even load up (sbt console never returns). Sbt command works for both projects on another computer. I have tried running sbt clean but I get the same result. Are there any steps I can take to troublehssot, gather more information and run the sbt console correctly? Sbt version is 0.13.9
I was able to run sbt after removing Build.scala and plugins.sbt file which were not needed for the project (perhaps I am mistaken in that assumption). For some reason, without removing the files, the sbt console was not coming up (or was going to take a very long time before coming up).

Can't get Spring Boot devtools auto restart get to work with 1.3M5 with Eclipse

I cant get SpringBoot autorestart get to work. I simply create http://start.spring.io/ Gradle project with DevTools selected and run 'gradle eclipse' to create eclipse project and 'gradle bootRun' and now I can do some change in project in Eclipse and this doesnt trigger auto restart at all. There is no message in bootRun console, no change detection. Any idea whats wrong here? I tried several times making starter project with http://start.spring.io and no way with auto restart ...
https://spring.io/blog/2015/06/17/devtools-in-spring-boot-1-3
Gradle in Eclipse and Gradle on the command line use different directories for their compiled classes. The dev tools (launched via bootRun) will be looking in build/classes whereas Eclipse will be compiling your changes into bin/classes. Rather than launching your app using gradle bootRun, try launching it in Eclipse instead using Run As -> Java application.
In one terminal:
gradle build --continuous
In second terminal:
gradle bootRun
Reference: https://dzone.com/articles/continuous-auto-restart-with-spring-boot-devtools
BTW, I find it take longer time than the eclipse.

How to build into Desktop Java?

So I know you can use ant and mvn to test the project, but I was wondering if there was a way to deploy the project directly as a executable jar or otherwise compile it into a format that can be directly ran? Thanks!
if you are serious about making a launchable desktop program (and especially if its going to be a game), you should use launch4j to make an exe file that launches the jar. It isn't hard to use, and it makes the program much more end user friendly
If your project was generated from the 1.7.2 PlayN archetype or newer, that functionality is already built in. Simply invoke:
mvn package
and a dependencies-included jar file will be generated in:
yourgame/java/target/yourgame-java-1.0-SNAPSHOT-jar-with-dependencies.jar
you can test it by running it standalone like so:
java -jar yourgame/java/target/yourgame-java-1.0-SNAPSHOT-jar-with-dependencies.jar
If your game was generated via an older PlayN archetype, the you can add the necessary bits to your java/pom.xml file by pasting in this in (merging with any existing <build> <plugins> blob):
maven-assembly-plugin
2.4
jar-with-dependencies
${mainClass}
make-assembly
package
single
Then just run mvn package as above to generate the file. Note that you will need to be building against PlayN 1.7.2 or newer as that version is the first one that supported automatic unpacking of the LWJGL native libraries needed to run on the desktop.

Resources