Skip to content

Build spring boot app with react frontend in separate modules using maven

Notifications You must be signed in to change notification settings

JohnnyBDude/springboot-react-multimodule

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

springboot-react-multimodule

This is an example of how bundling separate maven modules with spring backend and react frontend into single executable jar can be achieved.

Many thanks to Justin Calleja and Olivier Gérardin for their excellent blogposts on which this demo is based.

Both modules can be run separately during development to achieve hot-reloading and other development features, or they can be both packaged into single executable jar.

There are two ways to create the jar:

  • Either you can run mvn package on the root pom.xml, which builds backend, then frontend, then the bundle.
  • Or you can run mvn install on both, the backend/pom.xml, and frontend/pom.xml - which builds them and stores the result, then run mvn package on bundle/pom.xml. This eliminates the need for extra pom and makes it possible to store all of this in three independent repositories, then assembling the whole thing in your CI pipeline.

The resulting uber jar is stored in bundle/target and you can run it with java -jar bundle-0.0.1-SNAPSHOT.jar.

Then you can access the running app on localhost:8080.

About

Build spring boot app with react frontend in separate modules using maven

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages