|
|
9 年之前 | |
|---|---|---|
| src | 9 年之前 | |
| .babelrc | 9 年之前 | |
| .eslintrc | 9 年之前 | |
| .gitignore | 9 年之前 | |
| README.md | 9 年之前 | |
| package.json | 9 年之前 | |
| pom.xml | 9 年之前 | |
| webpack.config.js | 9 年之前 |
A demo project with Spring Boot, React and Webpack
This project includes :
There are 3 profiles :
To launch this project, just use the following command line :
In development mode : mvn clean spring-boot:run npm run watch
In production mode : mvn clean spring-boot:run -P production
Without a profile, you have to run the webpack watcher to deliver client resources. With the production profile, no needs to launch the wepback watcher.
To use the CloudFoundry and Release plugins, the settings.xml must contains the following lines :
<servers>
<server>
<id>cloudfoundry</id>
<username>username</username>
<password>password</password>
</server>
<server>
<id>github</id>
<username>username</username>
<password>password</password>
</server>
</servers>
Spring Boot is used as the backend server. It provides the HTML pages and the REST endpoints. React is server side compiled at runtime using nashorn.
React is the client side library. It's possible to write JSX which will be translate by webpack.
Webpack configuration is done by the webpack.config.js file at the project's root.
Webpack is launched at the generate-resources maven phase. In this configuration, webpack provides resources (JS and CSS) for commons librairies and custom JS scripts. It takes in account LESS. The HTML final resource is generated from a template adding the needed resources. Using the default profile and the watcher, the HotModuleReplacement module is activated, so no need to refresh the page when updating a JS or a CSS, webpack does it.
To manage the release process with Git, you have to replace the link in the developerConnection tag with the Git project URL.
The maven-release-plugin allows to release an app tagging the repository. A release is :
Two steps :
mvn release:prepare
mvn release:perform
To rollback a prepare :
mvn release:rollback
To test the release :
mvn -DdryRun=true release:prepare
mvn release:clean (test cleaning)
https://maven.apache.org/maven-release/maven-release-plugin/index.html
Change the TOFILL strings in the comment plugin's section.
The cf-maven-plugin plugin allows to manage the application in a CloudFoundry platform and specifically to push it :
mvn cf:push
http://docs.cloudfoundry.org/buildpacks/java/build-tool-int.html
The docker-maven-plugin (from Spotify) plugin has no configuration.
The default project packaging (for CloudFoundry) is a WAR. In the Docker image, we use a JAR. To use this plugin (and the correct packaging), use the docker profile :
mvn package -P docker
This command generates a local Docker image. To manage it, use the docker profile to access the docker-maven-plugin (such as push it).