Now package the project and make sure it builds properly (skip the license test as none of the files have a license header):
$ mvn clean package -Dlicense.skip=true [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building sdk5-demo 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ sdk5-demo --- [INFO] Deleting /Users/mbergljung/IDEAProjects/docs-new/sdk5/sdk5-demo/target [INFO] [INFO] --- license-maven-plugin:3.0:check (validate-license) @ sdk5-demo --- [INFO] [INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ sdk5-demo --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Using 'UTF-8' encoding to copy filtered properties files. [INFO] Copying 1 resource [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ sdk5-demo --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 1 source file to /Users/mbergljung/IDEAProjects/docs-new/sdk5/sdk5-demo/target/classes [INFO] [INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) @ sdk5-demo --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Using 'UTF-8' encoding to copy filtered properties files. [INFO] skip non existing resourceDirectory /Users/mbergljung/IDEAProjects/docs-new/sdk5/sdk5-demo/src/test/resources [INFO] [INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ sdk5-demo --- [INFO] Changes detected - recompiling the module! [INFO] [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ sdk5-demo --- [INFO] [INFO] --- maven-jar-plugin:3.2.0:jar (default-jar) @ sdk5-demo --- [INFO] Building jar: /Users/mbergljung/IDEAProjects/docs-new/sdk5/sdk5-demo/target/sdk5-demo-0.0.1-SNAPSHOT.jar [INFO] [INFO] --- spring-boot-maven-plugin:2.4.2:repackage (repackage) @ sdk5-demo --- [INFO] Replacing main artifact with repackaged archive [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 5.364 s [INFO] Finished at: 2021-04-07T14:12:53+01:00 [INFO] Final Memory: 24M/90M [INFO] ------------------------------------------------------------------------
You have successfully generated your first Spring Boot project.
Now that the JAR file has been created, in this case events-0.0.1-SNAPSHOT.jar, try and run the Spring Boot app:
$ java -jar target/sdk6-demo-0.0.1-SNAPSHOT.jar . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.4.2) 2021-04-07 14:15:13.514 INFO 52906 --- [ main] o.a.t.sdk5demo.Sdk5DemoApplication : Starting Sdk5DemoApplication v0.0.1-SNAPSHOT using Java 11.0.2 on MBP512-MBERGLJUNG-0917 with PID 52906 (/Users/mbergljung/IDEAProjects/docs-new/sdk5/sdk5-demo/target/sdk5-demo-0.0.1-SNAPSHOT.jar started by mbergljung in /Users/mbergljung/IDEAProjects/docs-new/sdk5/sdk5-demo) 2021-04-07 14:15:13.520 INFO 52906 --- [ main] o.a.t.sdk5demo.Sdk5DemoApplication : No active profile set, falling back to default profiles: default 2021-04-07 14:15:14.471 INFO 52906 --- [ main] o.a.t.sdk5demo.Sdk5DemoApplication : Started Sdk5DemoApplication in 1.697 seconds (JVM running for 2.257)
During development it’s useful to be able to build and run the extension in one go (so you don’t forget to build…). This can be done using the spring-boot-maven-plugin as follows:
mvn spring-boot:run -Dlicense.skip=true
We are now ready to add the specifics depending on what type of project we are going to develop:
- SDK Event handler project using pure Java. For more information, see Pure Java event handlers.
- SDK Event handler project using Spring Integration. For more information, see Spring Integration event handlers.
- SDK Java ReST API project. For more information, see Creating a Java ReST API extension project.
- SDK project using both event handling and Java ReST API. For more information, see Creating an extension project for both event handling and Java ReST API.