Skip to content

choonchernlim/choonchernlim-archetype-webapp

Repository files navigation

choonchernlim-archetype-webapp

Groovy-based Maven WAR archetype using Spring Boot with the capability of generating static code analysis reports for Continuous Integration servers.

Back-End Stack

Handles app security and generates Restful web services for front-end stack to consume. Spring Boot serves as the backbone of this archetype.

Key Dependencies Description
Swagger RESTful web services documentation tool and viewer
Apache Tomcat Embedded JEE server (for local development)
H2 Embedded database (for local development)
Spring Dependency injection, handles plumbing code
Spring Security App security
Spring Data JPA JPA-based repositories
Hibernate ORM framework
Spock Groovy test cases
Spring Boot CI Static code analysis reports for Continuous Integration servers

Front-End Stack

True single-page app from front-end-stack.

Prerequisites

  • Java version = 8.
  • Maven version >= 3.3.x.

Latest Release

<dependency>
  <groupId>com.github.choonchernlim</groupId>
  <artifactId>choonchernlim-archetype-webapp</artifactId>
  <version>2.0.0</version>
</dependency>

For example:

mvn archetype:generate 
-DinteractiveMode=false 
-DarchetypeGroupId=com.github.choonchernlim 
-DarchetypeArtifactId=choonchernlim-archetype-webapp 
-DarchetypeVersion=2.0.0
-DgroupId=com.github.choonchern.testProject 
-DartifactId=testProject 
-Dversion=1.0.0-SNAPSHOT

Getting Started

  • Run mvn clean spring-boot:run -Drun.profiles=local.

  • Open https://localhost:8443 in browser.

  • Follow further instruction on that main page.

Spring Profiles

  • This archetype is preconfigured with 3 Spring Profiles:-
    • middleware (default) - For generated WAR deployed in Middleware servers using JNDI data source. This is the default profile if spring.profiles.active is not specified.
    • local - For local development using H2 data source.
    • test - For running test cases.

How To...

Start Embedded Tomcat Server for Back-End Development

  • Run mvn clean spring-boot:run -Drun.profiles=local.

    • By default, this will perform yarn build to bundle the front-end JS files first before starting the server.
    • If there are no changes on front-end, you can speed it up by running mvn clean spring-boot:run -Drun.profiles=local -Pskip-frontend-build
  • Open https://localhost:8443 in browser.

Start Webpack Dev Server for Front-End Development

  • Change directory to src/main/frontend dir.

  • Run yarn start.

  • Open https://localhost:8080 in browser.

Create WAR File

  • Run mvn clean package.

Configure Jenkins Job

  • Create a "Freestyle project" job.

  • Under "Add build steps, select "Invoke top-level Maven targets".

    • Goals: -U clean test site

About

Groovy-based Maven WAR archetype using Spring Boot 2.x with the capability of generating static code analysis reports for Continuous Integration servers.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published