Skip to content
Patrik Beno edited this page Jul 27, 2015 · 7 revisions

Getting Started With SpringBoot Launcher

Getting the Launcher

$ curl -sL http://goo.gl/hzPKnQ | bash

Updating the Launcher

$ ~/.springboot/update.sh

First Run

$ java -jar ~/.springboot/springboot.jar

or

$ ~/.springboot/springboot.sh

or, if the launcher is in your ~/bin (handled optionally by installer):

$ springboot

(From now on, this document will use the latter form.)

Result:

Usage:
  java -jar springboot.jar [launcher-options] <artifact> [application-arguments]
  java -jar springboot.jar [launcher-options] <tool> <command> [command-options]
Artifact:
  <groupId>:<artifactId>:<version>[:<packaging>[:<classifier>]]
Tool(s):
  launch
  repository
  encrypt
  decrypt
  version
Launcher Options:
  apphome            : Application home directory
  appname            : Application name
  defaults           : Comma-separated list of URLs specifying hierarchy of MvnLauncher
                       configuration files (*.properties)
  debug              : Enables debug output
  quiet              : Suppresses any output but errors
  statusLine         : Enables status line feedback. Use if the autodetection fails.
  cache              : Directory where all cached files are stored.
  showClasspath      : Dump actual classpath information when constructed.
  offline            : Switches to offline mode. No repository operations are performed
                       and the process relies on cache only.
  updateInterval     : Remote repostitory update interval [seconds]
  verify             : Set this to false to disable downloaded artifact SHA1 verification.
  ignoreCache        : When enabled, cache content is ignored and
                       all artifacts are downloaded again.
  failOnError        : Disable this if you want to try execution despite the errors.
  cacheFileProtocol  : Disable this to use the file-based repository directly
                       (instead of caching them)
  updateReleases     : Enable this to check for updates to released
                       (usually one-time download) artifacts.
  updateSnapshots    : Disable this to ignore snapshot updates.
  execute            : Disable this to only update the application and skip its execution.
  update             : Enable this to ignore cache expiration flags
                       and force updates checking.
  repository         : Name of the repository to use. Such repository must have
                       corresponding entry in your vault (created previously using
                       --MvnLauncher.save=true)
  url                : Maven repository URL
  username           : Maven repository authentication: username
  password           : Maven repository authentication: password
  save               : true
  artifact           : Artifact URI (group:artifact:version)
See:
  https://github.com/patrikbeno/spring-boot/wiki/About
  https://github.com/patrikbeno/spring-boot/wiki/Getting-Started
  https://github.com/patrikbeno/spring-boot/wiki/Reference
Hint:
  Configure your `default` repository using `--MvnLauncher.save=true`
  and `--MvnLauncher.(url|username|password)` options.
  For non-default repository, specify also `--MvnLauncher.repository=<ID>`.
  Once configured, you can switch between repositories using `--MvnLauncher.repository=<ID>` option.
Generate Certificate and Private Key:
  $ mkdir ~/.springboot
  $ openssl genrsa | openssl pkcs8 -topk8 -nocrypt -out ~/.springboot/vault.key
  $ subject="/CN=$(whoami)@$(hostname)/OU=MyDepartment/O=MyOrganization/L=MyLocation/C=US"
  $ openssl req -new -x509 -days 1095 -subj "$subject" -key ~/.springboot/vault.key -out ~/.springboot/vault.crt

Viewing Default Configuration

$ springboot config
[INF] SpringBoot MvnLauncher 1.3.0.BUILD-SNAPSHOT
[DBG] MvnLauncher configuration:
[DBG] - MvnLauncher.apphome            : C:\java\jdk8\jre
[DBG] - MvnLauncher.appname            : SpringBootApp
[DBG] - MvnLauncher.defaults           : file:springboot.properties,file:///C:\java\jdk8\jre/SpringBootApp.properties,file:///C:\java\jdk8\jre/springboot.properties,file:///C:\Users\patrik/.springboot/defaults.properties,file:///etc/springboot/defaults.properties,classpath:META-INF/springboot/defaults.properties
[DBG] - MvnLauncher.repositories       : central,greenhorn
[DBG] - MvnLauncher.cache              : C:\Users\patrik/.springboot/cache
[DBG] - MvnLauncher.artifact           : null
[DBG] - MvnLauncher.debug              : true
[DBG] - MvnLauncher.quiet              : false
[DBG] - MvnLauncher.showClasspath      : false
[DBG] - MvnLauncher.offline            : false
[DBG] - MvnLauncher.updateInterval     : 1440
[DBG] - MvnLauncher.verify             : true
[DBG] - MvnLauncher.ignoreCache        : false
[DBG] - MvnLauncher.failOnError        : true
[DBG] - MvnLauncher.updateReleases     : false
[DBG] - MvnLauncher.updateSnapshots    : true
[DBG] - MvnLauncher.execute            : true
[DBG] - MvnLauncher.update             : false
[DBG] - MvnLauncher.skipDownload       : false
[DBG] - MvnLauncher.resolvers          : 7
[DBG] - MvnLauncher.downloaders        : 3
[DBG] - MvnLauncher.retries            : 3

Configuring Default Repository

By default, SpringBoot Launcher is linked to Central and Greenhorn repositories.

$ springboot repository \
    --id=myrepo \
    --url=http://nexus.example.com \
    --username=myuser --password=topsecret
Output:
springboot.mvnlauncher.repository.myrepo.url=http://nexus.example.com
springboot.mvnlauncher.repository.myrepo.username=myuser
springboot.mvnlauncher.repository.myrepo.password=${encrypted:a8014d39046997e34152af74b00b66614b5e95e4fdc7cc208dc47b184a767e4dd6235ca1b41be48927fc948eb46d97551ab09723e7552dab0edab8002b94a93619b63df930d4cf68b282d889bf2911ab452237a2f3404abab024d5b98682d342a05b6d3d557ae296e9fbaba27b10f245bbe59ba6d99d33cc41878e6a8e2bc1be}

You may ommit --username and --password parameters if your repository does not require authentication

You need to save this data in one of the default configuration files (see MvnLauncher.defaults). Typically, use add this into ~/.springboot/defaults.properties.

Running the SpringBoot Sample

$ springboot org.springframework.boot:spring-boot-sample-launcher:1.3.0.BUILD-SNAPSHOT

On first run, you may need to wait some time for the dependencies to be downloaded:

[INF] SpringBoot MvnLauncher 1.3.0.BUILD-SNAPSHOT
[INF] - Downloaded  : aopalliance:aopalliance:1.0:jar                                                  (   4KB @central)
[INF] - Downloaded  : ch.qos.logback:logback-classic:1.1.3:jar                                         ( 274KB @central)
[INF] - Downloaded  : ch.qos.logback:logback-core:1.1.3:jar                                            ( 444KB @central)
[INF] - Downloaded  : org.slf4j:jcl-over-slf4j:1.7.12:jar                                              (  16KB @central)
[INF] - Downloaded  : org.slf4j:jul-to-slf4j:1.7.12:jar                                                (   4KB @central)
[INF] - Downloaded  : org.slf4j:log4j-over-slf4j:1.7.12:jar                                            (  23KB @central)
[INF] - Downloaded  : org.slf4j:slf4j-api:1.7.12:jar                                                   (  31KB @central)
[INF] - Downloaded  : org.springframework.boot:spring-boot-autoconfigure:1.3.0.BUILD-20150727.171142-23:jar ( 646KB @central)
[INF] - Downloaded  : org.springframework.boot:spring-boot-sample-launcher:1.3.0.BUILD-20150727.182932-1:jar (   3KB @central)
[INF] - Downloaded  : org.springframework.boot:spring-boot-starter-logging:1.3.0.BUILD-20150727.171212-22:jar (   2KB @central)
[INF] - Downloaded  : org.springframework.boot:spring-boot-starter:1.3.0.BUILD-20150727.171214-22:jar  (   2KB @central)
[INF] - Downloaded  : org.springframework.boot:spring-boot:1.3.0.BUILD-20150727.171006-23:jar          ( 466KB @central)
[INF] - Downloaded  : org.springframework:spring-aop:4.2.0.BUILD-20150727.174954-620:jar               ( 355KB @central)
[INF] - Downloaded  : org.springframework:spring-beans:4.2.0.BUILD-20150727.174954-620:jar             ( 712KB @central)
[INF] - Downloaded  : org.springframework:spring-context:4.2.0.BUILD-20150727.174954-620:jar           (1059KB @central)
[INF] - Downloaded  : org.springframework:spring-core:4.2.0.BUILD-20150727.174954-620:jar              (1027KB @central)
[INF] - Downloaded  : org.springframework:spring-expression:4.2.0.BUILD-20150727.174954-620:jar        ( 256KB @central)
[INF] - Downloaded  : org.yaml:snakeyaml:1.15:jar                                                      ( 262KB @central)
[INF] Summary: 18 archives, 5593 KB total (resolved in 15583 msec, downloaded 5612 KB in 78 requests, 360 KBps). Warnings/Errors: 0/0.
... application output ...

Subsequent runs should be faster:

[INF] SpringBoot MvnLauncher 1.3.0.BUILD-SNAPSHOT
[INF] Summary: 18 archives, 5593 KB total (resolved in 118 msec, downloaded 0 KB in 0 requests, 0 KBps). Warnings/Errors: 0/0.
... application output ...

To disable this output, use --quiet parameter. To see more, use --debug. To force update, use --update, optionally in conjunction with --debug.