Prerequisites
To start developing Strolch you need an installed:- Java JDK 8
- Apache Maven 3
Getting Started
Setting up Strolch is just a few lines:
git clone https://github.com/4treesCH/strolch.git cd strolch mvn clean install -DskipTests
Note: To run the tests you will need to configure the PostgreSQL Databases. See the README in the module.
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.
Strolch Project Configuration
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.
The following sections describe the Strolch configuration files and folder structure.
You can also use the minimal project structure: strolch_minimal_rest
Project Structure
Strolch requires two main directories under the Strolch root:
- ../config/ → contains the Strolch runtime configuration
- StrolchConfiguration.xml → Main Strolch configuration file. There you configure the different realms, environments etc.
- PrivilegeConfig.xml → Configuration of the privilege management.
- PrivilegeUsers.xml → Configuration file with the different users and their role associations.
- PrivilegeRoles.xml → Configuration file with the different roles and privileges.
- ../data/ → contains the Strolch model and any other data which is modified at runtime.
- StrolchModel.xml → main model file which is read when Strolch is in TRANSIENT mode.
- ../tmp/ → contains any temporary files, e.g. log files etc.
Maven POM
Strolch is built using Maven, so here we show the minimum Maven POM for a web application:
<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"> <modelVersion>4.0.0</modelVersion> <properties> <strolch.version>1.6.47</strolch.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <warFinalName>strolch_webapp</warFinalName> <m2eclipse.wtp.contextRoot>${warFinalName}</m2eclipse.wtp.contextRoot> <buildTimestamp>${maven.build.timestamp}</buildTimestamp> </properties> <groupId>org.example</groupId> <artifactId>org.example.strolch.webapp</artifactId> <version>1.0.0-SNAPSHOT</version> <name>org.example.strolch.webapp</name> <packaging>war</packaging> <scm> <developerConnection>scm:git:https://git.example.org/strolch_webapp.git</developerConnection> </scm> <dependencyManagement> <dependencies> <dependency> <groupId>li.strolch</groupId> <artifactId>li.strolch.bom</artifactId> <type>pom</type> <version>${strolch.version}</version> </dependency> </dependencies> </dependencyManagement> <dependencies> <!-- main --> <dependency> <groupId>li.strolch</groupId> <artifactId>li.strolch.model</artifactId> <version>${strolch.version}</version> </dependency> <dependency> <groupId>li.strolch</groupId> <artifactId>li.strolch.agent</artifactId> <version>${strolch.version}</version> </dependency> <dependency> <groupId>li.strolch</groupId> <artifactId>li.strolch.service</artifactId> <version>${strolch.version}</version> </dependency> <dependency> <groupId>li.strolch</groupId> <artifactId>li.strolch.rest</artifactId> <version>${strolch.version}</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <scope>runtime</scope> <version>1.7.2</version> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.0.1</version> <scope>provided</scope> </dependency> <!-- test dependencies --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> <version>4.11</version> </dependency> </dependencies> <build> <finalName>${warFinalName}</finalName> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> <includes> <include>**/componentVersion.properties</include> </includes> </resource> <resource> <directory>src/main/resources</directory> <filtering>false</filtering> <excludes> <exclude>**/componentVersion.properties</exclude> </excludes> </resource> </resources> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.0</version> <configuration> <source>1.7</source> <target>1.7</target> <showDeprecation>true</showDeprecation> <showWarnings>true</showWarnings> <compilerArgument>-Xlint:all</compilerArgument> </configuration> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>buildnumber-maven-plugin</artifactId> <version>1.2</version> <executions> <execution> <phase>validate</phase> <goals> <goal>create</goal> </goals> </execution> </executions> <configuration> <doCheck>false</doCheck> <doUpdate>false</doUpdate> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <configuration> <failOnMissingWebXml>false</failOnMissingWebXml> <warName>${warFinalName}</warName> <webResources> <resource> <directory>src/main/non-packaged-resources</directory> <targetPath>WEB-INF</targetPath> <filtering>true</filtering> <includes> <include>**/ENV.properties</include> </includes> </resource> </webResources> </configuration> </plugin> </plugins> </build> <profiles> <profile> <id>m2e</id> <!-- This profile is only activated when building in Eclipse with m2e --> <activation> <property> <name>m2e.version</name> </property> </activation> <properties> <strolch.env>dev</strolch.env> </properties> </profile> </profiles> </project>
Happy coding =))