Skip to content

Instantly share code, notes, and snippets.

@mamachanko
Last active January 24, 2019 19:14
Show Gist options
  • Save mamachanko/b31d91da164bcec82eb0cc12b79ca3f3 to your computer and use it in GitHub Desktop.
Save mamachanko/b31d91da164bcec82eb0cc12b79ca3f3 to your computer and use it in GitHub Desktop.
Run pristine Spring Boot web app
➜ /tmp curl -sL git.io/fhr4u | bash -s 2.1.1.RELEASE
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 51161 100 51106 100 55 149k 164 --:--:-- --:--:-- --:--:-- 149k
Archive: web-app.zip
inflating: web-app/mvnw
creating: web-app/.mvn/
creating: web-app/.mvn/wrapper/
creating: web-app/src/
creating: web-app/src/main/
creating: web-app/src/main/java/
creating: web-app/src/main/java/com/
creating: web-app/src/main/java/com/example/
creating: web-app/src/main/java/com/example/demo/
creating: web-app/src/main/resources/
creating: web-app/src/main/resources/static/
creating: web-app/src/main/resources/templates/
creating: web-app/src/test/
creating: web-app/src/test/java/
creating: web-app/src/test/java/com/
creating: web-app/src/test/java/com/example/
creating: web-app/src/test/java/com/example/demo/
inflating: web-app/.gitignore
inflating: web-app/.mvn/wrapper/maven-wrapper.jar
inflating: web-app/.mvn/wrapper/maven-wrapper.properties
inflating: web-app/mvnw.cmd
inflating: web-app/pom.xml
inflating: web-app/src/main/java/com/example/demo/WebAppApplication.java
inflating: web-app/src/main/resources/application.properties
inflating: web-app/src/test/java/com/example/demo/WebAppApplicationTests.java
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------< com.example:demo >--------------------------
[INFO] Building web-app 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] >>> spring-boot-maven-plugin:2.1.1.RELEASE:run (default-cli) > test-compile @ demo >>>
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ demo ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /private/tmp/web-app/target/classes
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /private/tmp/web-app/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ demo ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /private/tmp/web-app/target/test-classes
[INFO]
[INFO] <<< spring-boot-maven-plugin:2.1.1.RELEASE:run (default-cli) < test-compile @ demo <<<
[INFO]
[INFO]
[INFO] --- spring-boot-maven-plugin:2.1.1.RELEASE:run (default-cli) @ demo ---
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.1.RELEASE)
2019-01-24 20:12:38.765 INFO 71352 --- [ main] com.example.demo.WebAppApplication : Starting WebAppApplication on 8850 with PID 71352 (/private/tmp/web-app/target/classes started by floater in /private/tmp/web-app)
2019-01-24 20:12:38.770 INFO 71352 --- [ main] com.example.demo.WebAppApplication : No active profile set, falling back to default profiles: default
2019-01-24 20:12:40.182 INFO 71352 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2019-01-24 20:12:40.230 INFO 71352 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-01-24 20:12:40.231 INFO 71352 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/9.0.13
2019-01-24 20:12:40.260 INFO 71352 --- [ main] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/Users/floater/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.]
2019-01-24 20:12:40.378 INFO 71352 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-01-24 20:12:40.378 INFO 71352 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1535 ms
2019-01-24 20:12:40.671 INFO 71352 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-01-24 20:12:40.958 INFO 71352 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2019-01-24 20:12:40.963 INFO 71352 --- [ main] com.example.demo.WebAppApplication : Started WebAppApplication in 2.692 seconds (JVM running for 6.919)
➜ /tmp curl -sL git.io/fhr4u | bash -s 2.1.2.RELEASE
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 51161 100 51106 100 55 52620 56 --:--:-- --:--:-- --:--:-- 52578
Archive: web-app.zip
inflating: web-app/mvnw
creating: web-app/.mvn/
creating: web-app/.mvn/wrapper/
creating: web-app/src/
creating: web-app/src/main/
creating: web-app/src/main/java/
creating: web-app/src/main/java/com/
creating: web-app/src/main/java/com/example/
creating: web-app/src/main/java/com/example/demo/
creating: web-app/src/main/resources/
creating: web-app/src/main/resources/static/
creating: web-app/src/main/resources/templates/
creating: web-app/src/test/
creating: web-app/src/test/java/
creating: web-app/src/test/java/com/
creating: web-app/src/test/java/com/example/
creating: web-app/src/test/java/com/example/demo/
inflating: web-app/.gitignore
inflating: web-app/.mvn/wrapper/maven-wrapper.jar
inflating: web-app/.mvn/wrapper/maven-wrapper.properties
inflating: web-app/mvnw.cmd
inflating: web-app/pom.xml
inflating: web-app/src/main/java/com/example/demo/WebAppApplication.java
inflating: web-app/src/main/resources/application.properties
inflating: web-app/src/test/java/com/example/demo/WebAppApplicationTests.java
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------< com.example:demo >--------------------------
[INFO] Building web-app 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] >>> spring-boot-maven-plugin:2.1.2.RELEASE:run (default-cli) > test-compile @ demo >>>
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ demo ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /private/tmp/web-app/target/classes
[ERROR] error reading /Users/floater/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.14/tomcat-embed-core-9.0.14.jar; zip file is empty
[ERROR] error reading /Users/floater/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.14/tomcat-embed-core-9.0.14.jar; zip file is empty
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /private/tmp/web-app/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ demo ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /private/tmp/web-app/target/test-classes
[ERROR] error reading /Users/floater/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.14/tomcat-embed-core-9.0.14.jar; zip file is empty
[ERROR] error reading /Users/floater/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.14/tomcat-embed-core-9.0.14.jar; zip file is empty
[INFO]
[INFO] <<< spring-boot-maven-plugin:2.1.2.RELEASE:run (default-cli) < test-compile @ demo <<<
[INFO]
[INFO]
[INFO] --- spring-boot-maven-plugin:2.1.2.RELEASE:run (default-cli) @ demo ---
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.2.RELEASE)
2019-01-24 20:14:22.214 INFO 71393 --- [ main] com.example.demo.WebAppApplication : Starting WebAppApplication on 8850 with PID 71393 (/private/tmp/web-app/target/classes started by floater in /private/tmp/web-app)
2019-01-24 20:14:22.218 INFO 71393 --- [ main] com.example.demo.WebAppApplication : No active profile set, falling back to default profiles: default
2019-01-24 20:14:23.374 INFO 71393 --- [ main] com.example.demo.WebAppApplication : Started WebAppApplication in 1.653 seconds (JVM running for 5.895)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.673 s
[INFO] Finished at: 2019-01-24T20:14:23+01:00
[INFO] ------------------------------------------------------------------------
#!/usr/bin/env bash -e
[[ -z "$1" ]] && {
echo "Usage e.g.: ./spring-boot-web-app.sh 2.1.1.RELEASE" ; exit 1;
}
SPRING_BOOT_VERSION=$1
rm -f web-app.zip
curl \
https://start.spring.io/starter.zip \
-d bootVersion=${SPRING_BOOT_VERSION} \
-d dependencies=web \
-d name=web-app \
-o web-app.zip
rm -rf web-app
mkdir web-app
unzip web-app.zip -d web-app
cd web-app
./mvnw spring-boot:run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment