<!doctype html><htmllang=enclass="js csstransforms3d"><head><metacharset=utf-8><metaname=viewportcontent="width=device-width,initial-scale=1"><metaname=generatorcontent="Hugo 0.80.0"><metaname=descriptioncontent="Strolch is a parameterized framework for use on servers and IoT"><metaname=authorcontent="Strolch"><linkrel=iconhref=/favicon.icotype=image/ico><title>Development - Strolch</title><linkhref=/css/nucleus.css?1660651465rel=stylesheet><linkhref=/css/fontawesome-all.min.css?1660651465rel=stylesheet><linkhref=/css/hybrid.css?1660651465rel=stylesheet><linkhref=/css/featherlight.min.css?1660651465rel=stylesheet><linkhref=/css/perfect-scrollbar.min.css?1660651465rel=stylesheet><linkhref=/css/auto-complete.css?1660651465rel=stylesheet><linkhref=/css/atom-one-dark-reasonable.css?1660651465rel=stylesheet><linkhref=/css/theme.css?1660651465rel=stylesheet><linkhref=/css/hugo-theme.css?1660651465rel=stylesheet><linkhref=/css/theme-green.css?1660651465rel=stylesheet><scriptsrc=/js/jquery-3.3.1.min.js?1660651465></script><style>:root#header+#content>#left>#rlblock_left{display:none!important}</style></head><bodydata-url=/development/><navid=sidebar><divid=header-wrapper><divid=header><aid=logohref=/><imgsrc=/logo.png></a></div><divclass=searchbox><labelfor=search-by><iclass="fas fa-search"></i></label><inputdata-search-inputid=search-bytype=searchplaceholder=Search...>
<spandata-search-clear><iclass="fas fa-times"></i></span></div><scripttype=text/javascriptsrc=/js/lunr.min.js?1660651465></script><scripttype=text/javascriptsrc=/js/auto-complete.js?1660651465></script><scripttype=text/javascript>varbaseurl="https:\/\/strolch.li\/";</script><scripttype=text/javascriptsrc=/js/search.js?1660651465></script></div><sectionid=homelinks><ul><li><aclass=paddinghref=/><iclass="fas fa-home"></i>Home</a></li></ul></section><divclass=highlightable><ulclass=topics><lidata-nav-id=/api/title=APIclass=dd-item><ahref=/api/>API</a></li><lidata-nav-id=/documentation/title=Documentationclass=dd-item><ahref=/documentation/>Documentation</a><ul><lidata-nav-id=/documentation/architecture/title=Architectureclass=dd-item><ahref=/documentation/architecture/>Architecture</a></li><lidata-nav-id=/documentation/model/title=Modelclass=dd-item><ahref=/documentation/model/>Model</a></li><lidata-nav-id=/documentation/do-and-donts/title="Do and Don't"class=dd-item><ahref=/documentation/do-and-donts/>Do and Don't</a></li><lidata-nav-id=/documentation/runtime-configuration/title="Runtime Configuration"class=dd-item><ahref=/documentation/runtime-configuration/>Runtime Configuration</a></li><lidata-nav-id=/documentation/realms/title=Realmsclass=dd-item><ahref=/documentation/realms/>Realms</a></li><lidata-nav-id=/documentation/components/title=Componentsclass=dd-item><ahref=/documentation/components/>Components</a></li><lidata-nav-id=/documentation/services-and-commands/title="Services and Commands"class=dd-item><ahref=/documentation/services-and-commands/>Services and Commands</a></li><lidata-nav-id=/documentation/searches/title=Searchesclass=dd-item><ahref=/documentation/searches/>Searches</a></li><lidata-nav-id=/documentation/queries/title=Queriesclass=dd-item><ahref=/documentation/queries/>Queries</a></li><lidata-nav-id=/documentation/transactions/title=Transactionsclass=dd-item><ahref=/documentation/transactions/>Transactions</a></li><lidata-nav-id=/documentation/policies/title=Policiesclass=dd-item><ahref=/documentation/policies/>Policies</a></li><lidata-nav-id=/documentation/observers/title=Observersclass=dd-item><ahref=/documentation/observers/>Observers</a></li><lidata-nav-id=/documentation/versioning/title=Versioningclass=dd-item><ahref=/documentation/versioning/>Versioning</a></li><lidata-nav-id=/documentation/reports/title=Reportsclass=dd-item><ahref=/documentation/reports/>Reports</a></li><lidata-nav-id=/documentation/priviles/title=Privilegesclass=dd-item><ahref=/documentation/priviles/>Privileges</a></li></ul></li><lidata-nav-id=/plc/title=PLCclass=dd-item><ahref=/plc/>PLC</a><ul><lidata-nav-id=/plc/architecture/title=Architectureclass=dd-item><ahref=/plc/architecture/>Architecture</a></li><lidata-nav-id=/plc/example-set-up/title="Example Set-Up"class=dd-item><ahref=/plc/example-set-up/>Example Set-Up</a></li></ul></li><lidata-nav-id=/tutorial/title=Tutorialclass=dd-item><ahref=/tutorial/>Tutorial</a><ul><lidata-nav-id=/tutorial/configuration/title=Configurationclass=dd-item><ahref=/tutorial/configuration/>Configuration</a></li><lidata-nav-id=/tutorial/model/title=Modelclass=dd-item><ahref=/tutorial/model/>Model</a></li><lidata-nav-id=/tutorial/crud-book/title="CRUD Book"class=dd-item><ahref=/tutorial/crud-book/>CRUD Book</a></li></ul></li><lidata-nav-id=/download/title=Downloadclass=dd-item><ahref=/download/>Download</a></li><lidata-nav-id=/development/title=Developmentclass="dd-item
active"><ahref=/development/>Development</a></li><lidata-nav-id=/blog/title=Blogclass=dd-item><ahref=/blog/>Blog</a><ul><lidata-nav-id=/blog/post-00016/title="Strolch PLC now also on Maven Central"class=dd-item><ahref=/blog/post-00016/>Strolch PLC now also on Maven Central</a></li><lidata-nav-id=/blog/post-00015/title="Release of Strolch 1.6.100"class=dd-item><ahref=/blog/post-00015/>Release of Strolch 1.6.100</a></li><lidata-nav-id=/blog/post-00014/title="Strolch Reports"class=dd-item><ahref=/blog/post-00014/>Strolch Reports</a></li><lidata-nav-id=/blog/post-00013/title="Strolch Searches"class=dd-item><ahref=/blog/post-00013/>Strolch Searches</a></li><lidata-nav-id=/blog/post-00012/title="Wow, the many changes!"class=dd-item><ahref=/blog/post-00012/>Wow, the many changes!</a></li><lidata-nav-id=/blog/post-00011/title="Strolch now on Maven Central"class=dd-item><ahref=/blog/post-00011/>Strolch now on Maven Central</a></li><lidata-nav-id=/blog/post-00010/title="Versioning of objects"class=dd-item><ahref=/blog/post-00010/>Versioning of objects</a></li><lidata-nav-id=/blog/post-00009/title="Release 1.2.0"class=dd-item><ahref=/blog/post-00009/>Release 1.2.0</a></li><lidata-nav-id=/blog/post-00008/title="Strolch Update"class=dd-item><ahref=/blog/post-00008/>Strolch Update</a></li><lidata-nav-id=/blog/post-00007/title="Activities: Beginning of the planning engine"class=dd-item><ahref=/blog/post-00007/>Activities: Beginning of the planning engine</a></li><lidata-nav-id=/blog/post-00006/title="Strolch Documentation"class=dd-item><ahref=/blog/post-00006/>Strolch Documentation</a></li><lidata-nav-id=/blog/post-00005/title="Strolch Release 1.0.0"class=dd-item><ahref=/blog/post-00005/>Strolch Release 1.0.0</a></li><lidata-nav-id=/blog/post-00004/title="DurationParameter and other minor changes: Release 1.0.0-RC4"class=dd-item><ahref=/blog/post-00004/>DurationParameter and other minor changes: Release 1.0.0-RC4</a></li><lidata-nav-id=/blog/post-00003/title="DB Initialization: Release 1.0.0-RC3"class=dd-item><ahref=/blog/post-00003/>DB Initialization: Release 1.0.0-RC3</a></li><lidata-nav-id=/blog/post-00002/title="Release 1.0.0-RC2"class=dd-item><ahref=/blog/post-00002/>Release 1.0.0-RC2</a></li><lidata-nav-id=/blog/post-00001/title="Release 1.0.0-RC1"class=dd-item><ahref=/blog/post-00001/>Release 1.0.0-RC1</a></li></ul></li></ul><sectionid=shortcuts><h3>More</h3><ul><li><aclass=paddinghref=https://strolch.li/tags><iclass="fas fa-tags"></i>Tags</a></li><li><aclass=paddinghref=https://github.com/strolch-litarget=_blank><iclass="fab fa-github"></i>GitHub project</a></li></ul></section><sectionid=footer><p>Built with <ahref=https://github.com/matcornic/hugo-theme-learntarget=_blank><iclass="fas fa-heart"></i></a>from <ahref=https://getgrav.orgtarget=_blank>Grav</a> and <ahref=https://gohugo.io/target=_blank>Hugo</a></p></section></div></nav><sectionid=body><divid=overlay></div><divclass="padding highlightable"><div><divid=top-bar><divid=top-github-link><aclass=github-linktitle="Edit this page"href=https://github.com/strolch-li/strolch-website/tree/develop/content/development/_index.mdtarget=blank><iclass="fas fa-code-branch"></i><spanid=top-github-link-text>Edit this page</span></a></div><divid=breadcrumbsitemscopeitemtype=http://data-vocabulary.org/Breadcrumb><spanid=sidebar-toggle-span><ahref=#id=sidebar-toggledata-sidebar-toggle><iclass="fas fa-bars"></i></a></span><spanid=toc-menu><iclass="fas fa-list-alt"></i></span><spanclass=links><ahref=/>Strolch Overview</a> > Development</span></div><divclass=progress><divclass=wrapper><navid=TableOfContents><ul><li><ahref=#prerequisites>Prerequisites</a></li><li><ahref=#building-strolch>Building Strolch</a></li><li><ahref=#creating-a-strolch-app>Creating a Strolch App</a><ul><li><ahref=#creating-a-java-strolch-web-app>Creating a Java Strolch Web App</a></li><li><ahref=#creating-a-simple-java-strolch-app>Creating a simple Java Strolch App</a></li></ul></li><li><ahref=#convertin
version on Maven central, but if you need a snapshot version, or the release you
want isn’t on central, then go ahead and build Strolch.</p></div><p>Building Strolch is just a few lines:</p><divclass=highlight><prestyle=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><codeclass=language-shelldata-lang=shell>git clone https://github.com/strolch-li/strolch.git
agent.</p><h2id=creating-a-strolch-app>Creating a Strolch App</h2><p>To create your own Strolch App, you can use Maven’s archetype generation. There
usual way to run Strolch runtimes.</p><divclass="notices warning"><p>Note: you need to have installed Strolch to your local maven repo, otherwise the
archetype won’t be available.</p></div><h3id=creating-a-java-strolch-web-app>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><divclass="notices tip"><p>The code is also available on <ahref=https://github.com/strolch-li/strolch/tree/develop/li.strolch.mvn.archetype.webapptarget=_blank>GitHub</a>.</p></div><divclass=highlight><prestyle=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><codeclass=language-shelldata-lang=shell>mvn archetype:generate <spanstyle=color:#ae81ff>\
</code></pre></div><h4id=install-the-web-dependencies>Install the web dependencies</h4><p>The Strolch Web App uses <ahref=https://nodejs.org/download/release/v11.15.0/target=_blank>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><divclass=highlight><prestyle=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><codeclass=language-shelldata-lang=shell>cd src/main/webapp/
again call npm install inside the webapp folder.</p></div><h4id=building-and-running-the-war>Building and running 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><p>To run this WAR, we must configure the path of Strolch’s runtime in the <code>StrolchBootstrap.xml</code> file, by updating the following block,
setting the absolute path to the <code>runtime</code> from the new project:</p><divclass=highlight><prestyle=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><codeclass=language-xmldata-lang=xml><spanstyle=color:#f92672><env</span><spanstyle=color:#a6e22e>id=</span><spanstyle=color:#e6db74>"test"</span><spanstyle=color:#a6e22e>default=</span><spanstyle=color:#e6db74>"true"</span><spanstyle=color:#f92672>></span>
</code></pre></div><p>Now we can build the project using the configured environment:</p><divclass=highlight><prestyle=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><codeclass=language-shelldata-lang=shell>mvn clean package -Prelease -Dstrolch.env<spanstyle=color:#f92672>=</span>test
</code></pre></div><p>Now copy the WAR from the <code>target/</code> directory to the <code>webapps/</code> directory of your Tomcat 9.x installation. Now you can start tomcat using:</p><divclass=highlight><prestyle=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><codeclass=language-shelldata-lang=shell>catalina.sh run
</code></pre></div><p>In the console you’ll then see something like this:</p><pre><codeclass=language-logdata-lang=log>INFO l.s.a.impl.ComponentContainerImpl:283 start - System: OS: Linux 5.16.15 Arch: amd64 on Java Azul Systems, Inc. 17 CPU Cores: 32
INFO l.s.a.impl.ComponentContainerImpl:284 start - Memory: Memory available 16.8 GB / Used: 604.0 MB / Free: 540.6 MB
INFO l.s.a.impl.ComponentContainerImpl:285 start - Using locale en with timezone Europe/Zurich
INFO l.s.a.impl.ComponentContainerImpl:288 start - file.encoding: UTF-8 / sun.jnu.encoding UTF-8
INFO l.s.a.impl.ComponentContainerImpl:307 start - eSyTest:test All 12 Strolch Components started. Took 43ms. Strolch is now ready to be used. Have fun =))
INFO c.atexxi.esytest.web.StartupListener:43 contextInitialized - Started eSyTest in 244ms
</code></pre><p>And now you can open a browser and login: <code>http://localhost:8080/<my-artifactId></code></p><p>The default username and password are <code>admin</code> / <code>admin</code>. After logging you, you should see the following view:</p><p><imgsrc=/assets/images/demo-app.pngalt="Strolch Demo App"></p><p>Happy coding =))</p><h3id=creating-a-simple-java-strolch-app>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><divclass="notices tip"><p>The code is also available on <ahref=https://github.com/strolch-li/strolch/tree/develop/li.strolch.mvn.archetype.maintarget=_blank>GitHub</a>.</p></div><divclass=highlight><prestyle=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><codeclass=language-shelldata-lang=shell>mvn archetype:generate <spanstyle=color:#ae81ff>\
</code></pre></div><p>You change into the directory of the new project and then build the project by calling:</p><divclass=highlight><prestyle=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><codeclass=language-shelldata-lang=shell>cd <my-artifactId>
mvn clean package
</code></pre></div><p>Start the program using:</p><divclass=highlight><prestyle=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><codeclass=language-shelldata-lang=shell>mvn exec:java
</code></pre></div><p>Happy coding =))</p><h2id=converting-an-existing-application>Converting an existing application</h2><p>You can convert an existing application to a Strolch agent, but this might be a
bit daunting in the beginning. If you are planning on doing this, first create a
test application using the maven archetypes, so that you can get a feel for the configuration.</p><p>Once that works, use the archetypes configuration to reconfigure your project to start as a Strolch agent.</p><divclass="notices warning"><p>Note: Beware to select the archetype pertaining to your use case:</p><ul><li>For a web app use the <ahref=/development/#creating-a-java-strolch-web-app>li.strolch.mvn.archetype.webapp</a></li><li>For a application with a main method use <ahref=/development/#creating-a-simple-java-strolch-app>li.strolch.mvn.archetype.main</a></li></ul></div><h2id=tools-used>Tools used</h2><p>The following tools are used to develop Strolch and Strolch-based projects:</p><ul><li><ahref="https://www.jetbrains.com/idea/download/#section=linux"target=_blank>IntelliJ</a></li><li><ahref=https://maven.apache.org/target=_blank>Apache Maven</a></li><li><ahref=http://git-scm.com/target=_blank>Git SCM</a></li></ul><footerclass=footline></footer></div></div><divid=navigation><aclass="nav nav-prev"href=/download/title=Download><iclass="fa fa-chevron-left"></i></a><aclass="nav nav-next"href=/blog/title=Blogstyle=margin-right:0><iclass="fa fa-chevron-right"></i></a></div></section><divstyle=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px><divstyle=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div></div><scriptsrc=/js/clipboard.min.js?1660651465></script><scriptsrc=/js/perfect-scrollbar.min.js?1660651465></script><scriptsrc=/js/perfect-scrollbar.jquery.min.js?1660651465></script><scriptsrc=/js/jquery.sticky.js?1660651465></script><scriptsrc=/js/featherlight.min.js?1660651465></script><scriptsrc=/js/highlight.pack.js?1660651465></script><script>hljs.initHighlightingOnLoad();</script><scriptsrc=/js/modernizr.custom-3.6.0.js?1660651465></script><scriptsrc=/js/learn.js?1660651465></script><scriptsrc=/js/hugo-learn.js?1660651465></script><scriptsrc=/mermaid/mermaid.js?1660651465></script><script>mermaid.initialize({startOnLoad:true});</script><scripttype=text/javascript>var_paq=window._paq=window._paq||[];_paq.push(["setDocumentTitle",document.domain+"/"+document.title]);_paq.push(["setCookieDomain","*.strolch.li"]);_paq.push(['trackPageView']);_paq.push(['enableLinkTracking']);(function(){varu="https://piwik.eitchnet.ch/";_paq.push(['setTrackerUrl',u+'matomo.php']);_paq.push(['setSiteId','2']);vard=document,g=d.createElement('script'),s=d.getElementsByTagName('script')[0];g.type='text/javascript';g.async=true;g.src=u+'matomo.js';s.parentNode.insertBefore(g,s);})();</script></body></html>