strolch/li.strolch.website/www.strolch.li/development.html

200 lines
8.5 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="google-site-verification" content="CPhbjooaiTdROm7Vs4E7kuHZvBfkeLUtonGgcVUbTL8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="ico/favicon.ico">
<title>Strolch: Development</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/custom.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script><![endif]-->
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="index.html">Strolch</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="index.html">Overview</a></li>
<li><a href="api.html">API</a></li>
<li><a href="documentation.html">Documentation</a></li>
<li><a href="plc.html">PLC</a></li>
<li><a href="tutorial.html">Tutorial</a></li>
<li><a href="downloads.html">Downloads</a></li>
<li class="active"><a href="development.html">Development</a></li>
<li><a href="blog.html">Blog</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
<div class="container">
<div class="page-header">
<h1 class="page-title">Development</h1>
<p class="lead page-description">This page describes how to setup the development environment.</p>
</div>
<div class="content">
<h2>Prerequisites</h2>
To start developing Strolch you need an installed:
<ul>
<li>Java JDK 8</li>
<li>Apache Maven 3</li>
</ul>
<h2>Building Strolch</h2>
<p>Setting up Strolch is just a few lines:</p>
<pre class="pre">
git clone https://github.com/4treesCH/strolch.git
cd strolch
mvn clean install -DskipTests</pre>
<p><b>Note:</b> To run the tests you will need to configure the PostgreSQL Databases. See the README in the
module.</p>
<p>After running the Maven build, you will have a full build of all Strolch projects. Now you can start
modifying the projects, and add your own features, or, far more interesting, start developing your projects
using the Strolch agent.</p>
<h2>Creating a Strolch App</h2>
<p>To create your own Strolch App, you can use Maven's archetype generation. There are two versions, one is a
simple Java App which you can use to directly access the Strolch runtime, and the second is to create a Java
Web App, which is the usual way to run Strolch runtimes.</p>
<p><b>Note:</b> you need to have installed Strolch to your local maven repo, otherwise the archetype won't be
available.</p>
<h3>Creating a simple Java Strolch App</h3>
<p>The following shows the maven command to create the new maven project. Note that you should replace the
placeholders in the brackets:</p>
<pre>
mvn archetype:generate \
-DarchetypeGroupId=li.strolch \
-DarchetypeArtifactId=li.strolch.mvn.archetype.main \
-DarchetypeVersion=1.6.0-SNAPSHOT \
-DgroupId=&lt;my.groupid&gt; \
-DartifactId=&lt;my-artifactId&gt; \
-Dversion=&lt;my.version&gt; \
-DappName="&lt;my app name&gt;"</pre>
<p>You change into the directory of the new project and then build the project by calling:</p>
<pre>
cd &lt;my-artifactId&gt;
mvn clean package</pre>
<p>Start the program using:</p>
<pre>
mvn exec:java</pre>
<p>Happy coding =))</p>
<h3>Creating a Java Strolch Web App</h3>
<p>The following shows the maven command to create the new maven project. Note that you should replace the
placeholders in the brackets:</p>
<pre>
mvn archetype:generate \
-DarchetypeGroupId=li.strolch \
-DarchetypeArtifactId=li.strolch.mvn.archetype.webapp \
-DarchetypeVersion=1.6.0-SNAPSHOT \
-DgroupId=&lt;my.groupid&gt; \
-DartifactId=&lt;my-artifactId&gt; \
-Dversion=&lt;my.version&gt; \
-DappName="&lt;my app name&gt;"</pre>
<h4>Install the web dependencies</h4>
<p>The Strolch Web App uses <a href="https://nodejs.org/download/release/v11.15.0/">NodeJS v11.x</a> to build
the web dependencies. Please download the relevant platform's package, unpack it, and add the
<code>bin</code> directory to your path variable. </p>
<p>Once NodeJS is installed, then you can prepare the web dependencies:</p>
<pre>
cd src/main/webapp/
npm install gulp -g
npm install
gulp</pre>
<p><b>Note:</b> Whenever the <code>bower.json</code> is changed then you should again call <code>npm
install</code>
inside the webapp folder.</p>
<h4>Building the WAR</h4>
<p>Building the WAR uses the <code>package</code> maven goal, but to have the optimized WAR use the <code>release</code>
profile:</p>
<pre>
mvn clean package -Prelease</pre>
<p>Happy coding =))</p>
<!-- content here -->
<h3>Tools used</h3>
The following tools are used to develop Strolch and Strolch-based projects:
<ul class="list-unstyled">
<li><a href="https://www.jetbrains.com/idea/download/#section=linux"><img style="height: 50px"
class="img-thumbnail"
src="https://upload.wikimedia.org/wikipedia/commons/d/d5/IntelliJ_IDEA_Logo.svg"
alt="IntelliJ IDEA" /></a></li>
<li><a href="https://maven.apache.org/"><img width="250"
style="height: 50px; margin-top: 10px"
class="img-thumbnail"
src="http://maven.apache.org/images/maventxt_logo_200.gif"
alt="Apache Maven 3.0" /></a></li>
<li><a href="http://git-scm.com/"><img style="height: 50px; margin-top: 10px"
class="img-thumbnail"
src="http://git-scm.com/images/logo@2x.png"
alt="git scm" /></a></li>
</ul>
</div><!-- /.content -->
<div id="footer">
<div class="container">
<p class="text-muted">&copy; Strolch / <a href="mailto:eitch@eitchnet.ch">Robert von Burg</a> / Hosting by
<a href="http://www.eitchnet.ch">eitchnet.ch</a></p>
</div>
</div>
</div><!-- /.container -->
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual xsd as needed -->
<script src="js/bootstrap.min.js"></script>
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function () {
var u = (("https:" == document.location.protocol) ? "https" : "http") + "://piwik.eitchnet.ch/";
_paq.push(['setTrackerUrl', u + 'piwik.php']);
_paq.push(['setSiteId', 2]);
var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
g.type = 'text/javascript';
g.defer = true;
g.async = true;
g.src = u + 'piwik.js';
s.parentNode.insertBefore(g, s);
})();
</script>
<noscript><p><img src="http://piwik.eitchnet.ch/piwik.php?idsite=2" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
</body>
</html>