mirror of
https://github.com/Febbweiss/febbweiss.github.io.git
synced 2026-03-04 22:25:43 +00:00
420 lines
14 KiB
HTML
420 lines
14 KiB
HTML
<!DOCTYPE html>
|
|
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
|
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
|
|
|
|
<title>Springboot react webpack - Febbweiss</title>
|
|
|
|
|
|
<link rel="shortcut icon" href="../../img/favicon.ico">
|
|
|
|
|
|
<link href='https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
|
|
|
|
<link rel="stylesheet" href="../../css/theme.css" type="text/css" />
|
|
<link rel="stylesheet" href="../../css/theme_extra.css" type="text/css" />
|
|
<link rel="stylesheet" href="../../css/highlight.css">
|
|
<link href="../../extra/css/extra.css" rel="stylesheet">
|
|
<link href="../../extra/css/sis.css" rel="stylesheet">
|
|
|
|
|
|
<script>
|
|
// Current page data
|
|
var mkdocs_page_name = "Springboot react webpack";
|
|
var mkdocs_page_input_path = "development/springboot_react_webpack.md";
|
|
var mkdocs_page_url = "/development/springboot_react_webpack/";
|
|
</script>
|
|
|
|
<script src="../../js/jquery-2.1.1.min.js"></script>
|
|
<script src="../../js/modernizr-2.8.3.min.js"></script>
|
|
<script type="text/javascript" src="../../js/highlight.pack.js"></script>
|
|
<script src="../../js/theme.js"></script>
|
|
<script src="../../extra/js/pacman.js"></script>
|
|
<script src="../../extra/js/pyramid.js"></script>
|
|
<script src="../../extra/js/sis.js"></script>
|
|
<script src="../../extra/js/yahtzee.js"></script>
|
|
|
|
|
|
</head>
|
|
|
|
<body class="wy-body-for-nav" role="document">
|
|
|
|
<div class="wy-grid-for-nav">
|
|
|
|
|
|
<nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
|
|
<div class="wy-side-nav-search">
|
|
<a href="../.." class="icon icon-home"> Febbweiss</a>
|
|
<div role="search">
|
|
<form id ="rtd-search-form" class="wy-form" action="../../search.html" method="get">
|
|
<input type="text" name="q" placeholder="Search docs" />
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
|
<ul class="current">
|
|
|
|
<li>
|
|
<li class="toctree-l1 ">
|
|
<a class="" href="../..">Home</a>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<li>
|
|
<ul class="subnav">
|
|
<li><span>Development</span></li>
|
|
|
|
|
|
|
|
<li class="toctree-l1 ">
|
|
<a class="" href="../cloudbudget/">Cloudbudget</a>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<li class="toctree-l1 ">
|
|
<a class="" href="../cloudbudget_angularjs/">Cloudbudget angularjs</a>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<li class="toctree-l1 ">
|
|
<a class="" href="../filebrowser_durandal_widget/">Filebrowser durandal widget</a>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<li class="toctree-l1 ">
|
|
<a class="" href="../project_deployer/">Project deployer</a>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<li class="toctree-l1 ">
|
|
<a class="" href="../scrabble_resolver/">Scrabble resolver</a>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<li class="toctree-l1 current">
|
|
<a class="current" href="./">Springboot react webpack</a>
|
|
|
|
<ul>
|
|
|
|
<li class="toctree-l3"><a href="#springboot-react-webpack">springboot-react-webpack</a></li>
|
|
|
|
<li><a class="toctree-l4" href="#profile">Profile</a></li>
|
|
|
|
<li><a class="toctree-l4" href="#launching">Launching</a></li>
|
|
|
|
<li><a class="toctree-l4" href="#configuration">Configuration</a></li>
|
|
|
|
<li><a class="toctree-l4" href="#spring-boot">Spring Boot</a></li>
|
|
|
|
<li><a class="toctree-l4" href="#react">React</a></li>
|
|
|
|
<li><a class="toctree-l4" href="#webpack">Webpack</a></li>
|
|
|
|
<li><a class="toctree-l4" href="#plugin-release">Plugin release</a></li>
|
|
|
|
<li><a class="toctree-l4" href="#plugin-cloudfoundry">Plugin CloudFoundry</a></li>
|
|
|
|
<li><a class="toctree-l4" href="#plugin-docker">Plugin Docker</a></li>
|
|
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
<li>
|
|
|
|
<li>
|
|
<ul class="subnav">
|
|
<li><span>Docker</span></li>
|
|
|
|
|
|
|
|
<li class="toctree-l1 ">
|
|
<a class="" href="../../docker/docker_apache_log_generator/">Docker apache log generator</a>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<li class="toctree-l1 ">
|
|
<a class="" href="../../docker/docker_gocd/">Docker gocd</a>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<li class="toctree-l1 ">
|
|
<a class="" href="../../docker/docker_java_log_generator/">Docker java log generator</a>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<li class="toctree-l1 ">
|
|
<a class="" href="../../docker/docker_log_centralizer/">Docker log centralizer</a>
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
<li>
|
|
|
|
<li>
|
|
<ul class="subnav">
|
|
<li><span>Games</span></li>
|
|
|
|
|
|
|
|
<li class="toctree-l1 ">
|
|
<a class="" href="../../games/Space_invaders_stories/">Space invaders stories</a>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<li class="toctree-l1 ">
|
|
<a class="" href="../../games/pacman/">Pacman</a>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<li class="toctree-l1 ">
|
|
<a class="" href="../../games/pyramid/">Pyramid</a>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<li class="toctree-l1 ">
|
|
<a class="" href="../../games/wordfighters/">Wordfighters</a>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<li class="toctree-l1 ">
|
|
<a class="" href="../../games/yahtzee/">Yahtzee</a>
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
<li>
|
|
|
|
</ul>
|
|
</div>
|
|
|
|
</nav>
|
|
|
|
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
|
|
|
|
|
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
|
|
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
|
<a href="../..">Febbweiss</a>
|
|
</nav>
|
|
|
|
|
|
<div class="wy-nav-content">
|
|
<div class="rst-content">
|
|
<div role="navigation" aria-label="breadcrumbs navigation">
|
|
<ul class="wy-breadcrumbs">
|
|
<li><a href="../..">Docs</a> »</li>
|
|
|
|
|
|
|
|
<li>Development »</li>
|
|
|
|
|
|
|
|
<li>Springboot react webpack</li>
|
|
<li class="wy-breadcrumbs-aside">
|
|
|
|
|
|
<a href="https://github.com/febbweiss/" class="icon icon-github"> Edit on GitHub</a>
|
|
|
|
|
|
</li>
|
|
</ul>
|
|
<hr/>
|
|
</div>
|
|
<div role="main">
|
|
<div class="section">
|
|
|
|
<h1 id="springboot-react-webpack">springboot-react-webpack</h1>
|
|
<p>A demo project with Spring Boot, React and Webpack</p>
|
|
<p>This project includes :</p>
|
|
<ul>
|
|
<li>Spring Boot as backend resource</li>
|
|
<li>React as client JS framework</li>
|
|
<li>webpack to translate JSX to JS and manage client resources link</li>
|
|
<li>maven-release-plugin</li>
|
|
<li>cf-maven-plugin</li>
|
|
<li>docker-maven-plugin (from Spotify)</li>
|
|
</ul>
|
|
<h2 id="profile">Profile</h2>
|
|
<p>There are 3 profiles :</p>
|
|
<ul>
|
|
<li>the default one (without specification) is for development mode.</li>
|
|
<li><em>production</em> used to generate the production ready client resources</li>
|
|
<li><em>docker</em> to access to the Docker plugin and generate an image</li>
|
|
</ul>
|
|
<h2 id="launching">Launching</h2>
|
|
<p>To launch this project, just use the following command line :</p>
|
|
<p>In development mode :</p>
|
|
<pre><code>mvn clean spring-boot:run
|
|
npm run watch
|
|
</code></pre>
|
|
|
|
<p>In production mode :</p>
|
|
<pre><code>mvn clean spring-boot:run -P production
|
|
</code></pre>
|
|
|
|
<p>Without a profile, you have to run the webpack watcher to deliver client resources. With the <em>production</em> profile, no needs to launch the wepback watcher.</p>
|
|
<h2 id="configuration">Configuration</h2>
|
|
<p>To use the CloudFoundry and Release plugins, the <em>settings.xml</em> must contains the following lines :</p>
|
|
<pre><code class="xml"> <servers>
|
|
<server>
|
|
<id>cloudfoundry</id>
|
|
<username>username</username>
|
|
<password>password</password>
|
|
</server>
|
|
<server>
|
|
<id>github</id>
|
|
<username>username</username>
|
|
<password>password</password>
|
|
</server>
|
|
</servers>
|
|
</code></pre>
|
|
|
|
<h2 id="spring-boot">Spring Boot</h2>
|
|
<p>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.</p>
|
|
<h2 id="react">React</h2>
|
|
<p>React is the client side library. It's possible to write JSX which will be translate by webpack.</p>
|
|
<h2 id="webpack">Webpack</h2>
|
|
<h3 id="configuration_1">Configuration</h3>
|
|
<p>Webpack configuration is done by the <em>webpack.config.js</em> file at the project's root.</p>
|
|
<h3 id="usage">Usage</h3>
|
|
<p>Webpack is launched at the <em>generate-resources</em> 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.</p>
|
|
<h2 id="plugin-release">Plugin release</h2>
|
|
<h3 id="configuration_2">Configuration</h3>
|
|
<p>To manage the release process with Git, you have to replace the link in the <em>developerConnection</em> tag with the Git project URL.</p>
|
|
<h3 id="usage_1">Usage</h3>
|
|
<p>The <em>maven-release-plugin</em> allows to release an app tagging the repository. A release is :
|
|
<em> changing from SNAPSHOT to stable
|
|
</em> creating a tag (locally and remotely)
|
|
* increasing the SNAPSHOT version</p>
|
|
<p>Two steps :</p>
|
|
<pre><code>mvn release:prepare
|
|
mvn release:perform
|
|
</code></pre>
|
|
|
|
<p>To rollback a <em>prepare</em> :</p>
|
|
<pre><code>mvn release:rollback
|
|
</code></pre>
|
|
|
|
<p>To test the release :</p>
|
|
<pre><code>mvn -DdryRun=true release:prepare
|
|
mvn release:clean (test cleaning)
|
|
</code></pre>
|
|
|
|
<h3 id="documentation">Documentation</h3>
|
|
<p><a href="https://maven.apache.org/maven-release/maven-release-plugin/index.html">https://maven.apache.org/maven-release/maven-release-plugin/index.html</a></p>
|
|
<h2 id="plugin-cloudfoundry">Plugin CloudFoundry</h2>
|
|
<h3 id="configuration_3">Configuration</h3>
|
|
<p>Change the <em>TOFILL</em> strings in the comment plugin's section.</p>
|
|
<h3 id="usage_2">Usage</h3>
|
|
<p>The <em>cf-maven-plugin</em> plugin allows to manage the application in a CloudFoundry platform and specifically to push it :</p>
|
|
<pre><code>mvn cf:push
|
|
</code></pre>
|
|
|
|
<h3 id="documentation_1">Documentation</h3>
|
|
<p><a href="http://docs.cloudfoundry.org/buildpacks/java/build-tool-int.html">http://docs.cloudfoundry.org/buildpacks/java/build-tool-int.html</a></p>
|
|
<h2 id="plugin-docker">Plugin Docker</h2>
|
|
<h3 id="configuration_4">Configuration</h3>
|
|
<p>The <em>docker-maven-plugin</em> (from Spotify) plugin has no configuration.</p>
|
|
<h3 id="usage_3">Usage</h3>
|
|
<p>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 <em>docker</em> profile :</p>
|
|
<pre><code>mvn package -P docker
|
|
</code></pre>
|
|
|
|
<p>This command generates a local Docker image. To manage it, use the <em>docker</em> profile to access the <em>docker-maven-plugin</em> (such as push it).</p>
|
|
<h3 id="documentation_2">Documentation</h3>
|
|
<p><a href="https://github.com/spotify/docker-maven-plugin">https://github.com/spotify/docker-maven-plugin</a></p>
|
|
<p><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.0/gh-fork-ribbon.min.css" />
|
|
<!--[if lt IE 9]>
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.0/gh-fork-ribbon.ie.min.css" />
|
|
<![endif]-->
|
|
<a class="github-fork-ribbon" href="https://github.com/Febbweiss/springboot-react-webpack" target="_blank" title="Fork me on GitHub">Fork me on GitHub</a></p>
|
|
|
|
</div>
|
|
</div>
|
|
<footer>
|
|
|
|
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
|
|
|
|
<a href="../../docker/docker_apache_log_generator/" class="btn btn-neutral float-right" title="Docker apache log generator">Next <span class="icon icon-circle-arrow-right"></span></a>
|
|
|
|
|
|
<a href="../scrabble_resolver/" class="btn btn-neutral" title="Scrabble resolver"><span class="icon icon-circle-arrow-left"></span> Previous</a>
|
|
|
|
</div>
|
|
|
|
|
|
<hr/>
|
|
|
|
<div role="contentinfo">
|
|
<!-- Copyright etc -->
|
|
|
|
</div>
|
|
|
|
Built with <a href="http://www.mkdocs.org">MkDocs</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
|
</footer>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</div>
|
|
|
|
<div class="rst-versions" role="note" style="cursor: pointer">
|
|
<span class="rst-current-version" data-toggle="rst-current-version">
|
|
|
|
<a href="https://github.com/febbweiss/" class="icon icon-github" style="float: left; color: #fcfcfc"> GitHub</a>
|
|
|
|
|
|
<span><a href="../scrabble_resolver/" style="color: #fcfcfc;">« Previous</a></span>
|
|
|
|
|
|
<span style="margin-left: 15px"><a href="../../docker/docker_apache_log_generator/" style="color: #fcfcfc">Next »</a></span>
|
|
|
|
</span>
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|