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

344 lines
14 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="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>Getting Started</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>Strolch Project Configuration</h2>
<p>To use Strolch in your own projects, look at the two tutorial apps on how they are configured. You can also
simply copy the projects, modify the Maven POMs and remove what ever you do not need.</p>
<p>The following sections describe the Strolch configuration files and folder structure.</p>
<p>You can also use the minimal project structure:
<a href="https://github.com/4treesCH/strolch/tree/develop/strolch_minimal_rest">strolch_minimal_rest</a></p>
<h3>Project Structure</h3>
<p>Strolch requires two main directories under the Strolch root:</p>
<ul>
<li>../config/ &rarr; contains the Strolch runtime configuration
<ul>
<li>StrolchConfiguration.xml &rarr; Main Strolch configuration file. There you configure the
different realms, environments etc.
</li>
<li>PrivilegeConfig.xml &rarr; Configuration of the privilege management.</li>
<li>PrivilegeUsers.xml &rarr; Configuration file with the different users and their role
associations.
</li>
<li>PrivilegeRoles.xml &rarr; Configuration file with the different roles and privileges.</li>
</ul>
</li>
<li>../data/ &rarr; contains the Strolch model and any other data which is modified at runtime.
<ul>
<li>StrolchModel.xml &rarr; main model file which is read when Strolch is in <i>TRANSIENT</i> mode.
</li>
</ul>
</li>
<li>../tmp/ &rarr; contains any temporary files, e.g. log files etc.</li>
</ul>
<h3>Maven POM</h3>
<p>Strolch is built using Maven, so here we show the minimum Maven POM for a web application:</p>
<pre class="pre-scrollable">
&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
&lt;properties&gt;
&lt;strolch.version&gt;1.6.47&lt;/strolch.version&gt;
&lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
&lt;warFinalName&gt;strolch_webapp&lt;/warFinalName&gt;
&lt;m2eclipse.wtp.contextRoot&gt;${warFinalName}&lt;/m2eclipse.wtp.contextRoot&gt;
&lt;buildTimestamp&gt;${maven.build.timestamp}&lt;/buildTimestamp&gt;
&lt;/properties&gt;
&lt;groupId&gt;org.example&lt;/groupId&gt;
&lt;artifactId&gt;org.example.strolch.webapp&lt;/artifactId&gt;
&lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
&lt;name&gt;org.example.strolch.webapp&lt;/name&gt;
&lt;packaging&gt;war&lt;/packaging&gt;
&lt;scm&gt;
&lt;developerConnection&gt;scm:git:https://git.example.org/strolch_webapp.git&lt;/developerConnection&gt;
&lt;/scm&gt;
&lt;dependencyManagement&gt;
&lt;dependencies&gt;
&lt;dependency&gt;
&lt;groupId&gt;li.strolch&lt;/groupId&gt;
&lt;artifactId&gt;li.strolch.bom&lt;/artifactId&gt;
&lt;type&gt;pom&lt;/type&gt;
&lt;version&gt;${strolch.version}&lt;/version&gt;
&lt;/dependency&gt;
&lt;/dependencies&gt;
&lt;/dependencyManagement&gt;
&lt;dependencies&gt;
&lt;!-- main --&gt;
&lt;dependency&gt;
&lt;groupId&gt;li.strolch&lt;/groupId&gt;
&lt;artifactId&gt;li.strolch.model&lt;/artifactId&gt;
&lt;version&gt;${strolch.version}&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;li.strolch&lt;/groupId&gt;
&lt;artifactId&gt;li.strolch.agent&lt;/artifactId&gt;
&lt;version&gt;${strolch.version}&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;li.strolch&lt;/groupId&gt;
&lt;artifactId&gt;li.strolch.service&lt;/artifactId&gt;
&lt;version&gt;${strolch.version}&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;li.strolch&lt;/groupId&gt;
&lt;artifactId&gt;li.strolch.rest&lt;/artifactId&gt;
&lt;version&gt;${strolch.version}&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.slf4j&lt;/groupId&gt;
&lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
&lt;scope&gt;runtime&lt;/scope&gt;
&lt;version&gt;1.7.2&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;javax.servlet&lt;/groupId&gt;
&lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
&lt;version&gt;3.0.1&lt;/version&gt;
&lt;scope&gt;provided&lt;/scope&gt;
&lt;/dependency&gt;
&lt;!-- test dependencies --&gt;
&lt;dependency&gt;
&lt;groupId&gt;junit&lt;/groupId&gt;
&lt;artifactId&gt;junit&lt;/artifactId&gt;
&lt;scope&gt;test&lt;/scope&gt;
&lt;version&gt;4.11&lt;/version&gt;
&lt;/dependency&gt;
&lt;/dependencies&gt;
&lt;build&gt;
&lt;finalName&gt;${warFinalName}&lt;/finalName&gt;
&lt;resources&gt;
&lt;resource&gt;
&lt;directory&gt;src/main/resources&lt;/directory&gt;
&lt;filtering&gt;true&lt;/filtering&gt;
&lt;includes&gt;
&lt;include&gt;**/componentVersion.properties&lt;/include&gt;
&lt;/includes&gt;
&lt;/resource&gt;
&lt;resource&gt;
&lt;directory&gt;src/main/resources&lt;/directory&gt;
&lt;filtering&gt;false&lt;/filtering&gt;
&lt;excludes&gt;
&lt;exclude&gt;**/componentVersion.properties&lt;/exclude&gt;
&lt;/excludes&gt;
&lt;/resource&gt;
&lt;/resources&gt;
&lt;plugins&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
&lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
&lt;version&gt;3.0&lt;/version&gt;
&lt;configuration&gt;
&lt;source&gt;1.7&lt;/source&gt;
&lt;target&gt;1.7&lt;/target&gt;
&lt;showDeprecation&gt;true&lt;/showDeprecation&gt;
&lt;showWarnings&gt;true&lt;/showWarnings&gt;
&lt;compilerArgument&gt;-Xlint:all&lt;/compilerArgument&gt;
&lt;/configuration&gt;
&lt;/plugin&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
&lt;artifactId&gt;buildnumber-maven-plugin&lt;/artifactId&gt;
&lt;version&gt;1.2&lt;/version&gt;
&lt;executions&gt;
&lt;execution&gt;
&lt;phase&gt;validate&lt;/phase&gt;
&lt;goals&gt;
&lt;goal&gt;create&lt;/goal&gt;
&lt;/goals&gt;
&lt;/execution&gt;
&lt;/executions&gt;
&lt;configuration&gt;
&lt;doCheck&gt;false&lt;/doCheck&gt;
&lt;doUpdate&gt;false&lt;/doUpdate&gt;
&lt;/configuration&gt;
&lt;/plugin&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
&lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
&lt;configuration&gt;
&lt;failOnMissingWebXml&gt;false&lt;/failOnMissingWebXml&gt;
&lt;warName&gt;${warFinalName}&lt;/warName&gt;
&lt;webResources&gt;
&lt;resource&gt;
&lt;directory&gt;src/main/non-packaged-resources&lt;/directory&gt;
&lt;targetPath&gt;WEB-INF&lt;/targetPath&gt;
&lt;filtering&gt;true&lt;/filtering&gt;
&lt;includes&gt;
&lt;include&gt;**/ENV.properties&lt;/include&gt;
&lt;/includes&gt;
&lt;/resource&gt;
&lt;/webResources&gt;
&lt;/configuration&gt;
&lt;/plugin&gt;
&lt;/plugins&gt;
&lt;/build&gt;
&lt;profiles&gt;
&lt;profile&gt;
&lt;id&gt;m2e&lt;/id&gt;
&lt;!-- This profile is only activated when building in Eclipse with m2e --&gt;
&lt;activation&gt;
&lt;property&gt;
&lt;name&gt;m2e.version&lt;/name&gt;
&lt;/property&gt;
&lt;/activation&gt;
&lt;properties&gt;
&lt;strolch.env&gt;dev&lt;/strolch.env&gt;
&lt;/properties&gt;
&lt;/profile&gt;
&lt;/profiles&gt;
&lt;/project&gt;</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.eclipse.org/downloads/"><img style="height: 50px"
class="img-thumbnail"
src="https://www.eclipse.org/downloads/packages/sites/all/themes/solstice/_themes/solstice_packages/logo.png"
alt="Eclipse Luna JEE version" /></a></li>
<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>