Comments (10)
https://github.com/sbt/launcher hosts launcher-interface and launcher. launcher-interface is the Java interface that exposes an API to the application to be launched, whereas launcher
is an รผber JAR of a generic launcher implementation. This code lives somewhat independently from sbt. sbt-launch
is a repackaging of launcher
with sbt's configuration like which repositories to read from (it used to be hosted on an Ivy repo for sbt 0.13, for example).
from sbt.
Probably coming from https://github.com/sbt/launcher/blob/1.x/launcher-implementation/src/main/scala/xsbt/boot/Boot.scala. Would a system property like sbt.boot.exit=false
work?
from sbt.
Would a system property like
sbt.boot.exit=false
work?
For my use-case, yes. Though I believe that introducing conditional code for this could be more complex and introduce pitfalls (like users setting that system property despite using SBT via the CLI) compared to just doing a refactoring that introduces a runLauncher()
or similar function (sorry, pseudo-code):
main(String args) {
arrayOfArgs = parseArgs(args)
runLauncher(arrayOfArgs)
exit(0)
}
runLauncher(Array args) {
// Do the actual work.
}
The Jar's main entry point would still be main()
, but programmatic users could just call runlauncher()
instead.
from sbt.
I don't know if the original scope of sbt launcher was to be a generic launcher, but given that almost no one else but sbt uses it I'd suggest looking into Couriser app as a launcher, or drive Coursier programmatically instead.
Here's launcher code for Giter8 for example https://github.com/foundweekends/giter8/blob/develop/launcher/src/main/scala/LauncherMain.scala that resolves artifacts from Maven repo and calls run
via reflection.
from sbt.
Hmm, I'm starting to get confused about launcher-related artifacts now... what's the difference between
- https://mvnrepository.com/artifact/org.scala-sbt/sbt-launch
- https://mvnrepository.com/artifact/org.scala-sbt/launcher
- https://mvnrepository.com/artifact/org.scala-sbt/launcher-interface
from sbt.
Thanks. And where does Coursier now come into play? IIUC Coursier is "just" a dependency resolver, but not a launcher. So maybe launcher
at some point started to use Coursier as the dependency resolver?
Anyway, what I'm looking for is a way to programmatically bootstrap the SBT version configured in a project, just like the launcher does, and to run commands like sbt projects
/ sbt makePom
just like from the command line. All in all, what's your recommendation how to achieve that currently?
from sbt.
Anyway, what I'm looking for is a way to programmatically bootstrap the SBT version... All in all, what's your recommendation how to achieve that currently?
To some extent that's what CI process like GitHub Actions and Jenkins do basically by creating files and shelling out to an external process. So think that would be probably the easiest regardless of the programming language you're currently on. You can use sbt --client
for example to let sbt server run in the background so you don't pay the loading for each command, and shut it down with sbt --client shutdown
.
from sbt.
Related Issues (20)
- `console` does not work with Scala 2.13.13, sbt 1.9.8 HOT 12
- `illegal reflective access operation` using sbt 1.9.9 with Java 11 (but not 8 or 17 or 21) HOT 2
- When there is a corrupted jar in Maven's local repo, it will fail HOT 2
- `sbt new` fails to parse arguments correctly on Windows HOT 3
- sbt throws a `StackOverflowError` when reporting a self-referencing exception. HOT 2
- improvement: [BSP] Add `jvmBuildTarget` info to `workspace/buildTargets` response
- Packages including "scala-library" in its name cannot be imported by other projects. HOT 1
- `getClass.getResource` yields wrong result using 1.9.9 with `sbtPlugin := true` HOT 3
- Found [error] [launcher] error during sbt launcher: java.nio.file.AccessDeniedException: /run/user/0/.sbt on AMI 2023 HOT 2
- sbt launcher - error retrieving required libraries for SBT 0.x HOT 17
- scaladoc: does not include all inline concrete methods HOT 1
- Sbt compile cannot include the dependency jar to classpath HOT 7
- sbt in `--client` mode loses stdout/stderr of the forked processes in continuous (watch) task mode after the task ir reevaluated
- Error downloading org.scalameta:semanticdb-scalac_2.12.19:4.8.3 HOT 2
- Command alias doesn't work with the project prefix HOT 1
- Compile ClassCastException HOT 1
- "java.lang.Boolean cannot be cast to class java.lang.String" on Play's run task HOT 37
- Unreachable case warning (E121) in inline generic function HOT 2
- Pipelining prevents Java compilation with `compileOrder := JavaThenScala` config
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sbt.