Tunning the evacuation project configuration
In this tutorial, we describe the process of updating the maven project’s configurations to manage the project’s dependencies, build, and reporting settings.
-
-
- To better understand the project’s structure and how its inner packages are decomposed, we change the project and package presentations to a hierarchical view. We can do this by:
- As shown in the figure below, press the inverted triangle button located at the top right corner of your project explorer, choose “Projects Presentation” and select “Hierarchical”.
- In the same way, press the inverted triangle button located at the top right corner of your project explorer again, choose “Package Presentation” and select “Hierarchical”.
- As shown in the figure below, press the inverted triangle button located at the top right corner of your project explorer, choose “Projects Presentation” and select “Hierarchical”.
- Open the project object model (POM) for the “evacuation” project. To do so, double click on the file pom.xml under the “evacuation” project. The Maven POM Editor should appear.
- In the opened window, click on the tab “pom.xml”.
- The content of the project object model (POM) should be displayed in XML format as follows:
<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/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>edu.utdallas.mavs.evacuation</groupId> <artifactId>evacuation</artifactId> <version>1.0.0-SNAPSHOT</version> <packaging>pom</packaging> <name>Evacuation Simulation System</name> <description>This is a tutorial on how to create a simple Evacuation Simulation System</description> <modules> <module>evacuation-simulation</module> <module>evacuation-visualization</module> <module>evacuation-gui</module> </modules> </project>
- Add information about the project developers to the “pom.xml” file as follows:
<organization> <name>Multi-Agent and Visualization Systems Lab</name> <url>http://mavs.utdallas.edu</url> </organization> <developers> <developer> <id>Araujo</id> <name>Frederico Araujo</name> <email>frederico.araujo@utdallas.edu</email> <url>http://www.utdallas.edu/~frederico.araujo</url> <organization /> <organizationUrl /> <roles> <role>Architect</role> <role>Developer</role> </roles> <timezone /> <properties /> </developer> <developer> <id>Valente</id> <name>Junia Valente</name> <email>juniavalente@utdallas.edu</email> <url>http://utdallas.edu/~juniavalente</url> <organization /> <organizationUrl /> <roles> <role>Architect</role> <role>Developer</role> </roles> <timezone /> <properties /> </developer> <developer> <id>Al-Zinati</id> <name>Mohammad</name> <email>mha091020@utdallas.edu</email> <url></url> <organization /> <organizationUrl /> <roles> <role>Architect</role> <role>Developer</role> </roles> <timezone /> <properties /> </developer> </developers>
- Add the version number of all external libraries that will be used to develop the evacuation simulator to the “pom.xml” file as follows (You can always add more libraries when needed):
<properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <myjdkversion>1.7</myjdkversion> <divas.version>4.0.19-SNAPSHOT</divas.version> <jmonkey.version>3.0.0-09.24.2012-SNAPSHOT</jmonkey.version> <nifty.version>1.3.1</nifty.version> <slf4j.version>1.7.5</slf4j.version> <log4j.version>1.2.17</log4j.version> <junit.version>4.11</junit.version> <guice.version>3.0</guice.version> <activeMQ.version>5.7.0</activeMQ.version> </properties>
- Add information about all external libraries (dependencies) that will be used globally in this project. You can get the information about each of these dependencies using Maven Repository website. For instance, we use the libraries “log4j”, “slf4j”, and “junit” across all the “evacuation” project modules. The following lines should be added to the “pom.xml”:
<!-- ======================================= --> <!-- ==== Global Dependencies === --> <!-- ======================================= --> <dependencies> <!-- Logging --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>${slf4j.version}</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>${slf4j.version}</version> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>${log4j.version}</version> </dependency> <dependency> <groupId>org.perf4j</groupId> <artifactId>perf4j</artifactId> <version>0.9.16</version> </dependency> <!-- Test only --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>${junit.version}</version> <scope>test</scope> </dependency> </dependencies>
- Copy/paste the following code into the “pom.xml” file to define how your project will be built by maven:
<!-- ======================================= --> <!-- ==== Dependencies Management === --> <!-- ======================================= --> <dependencyManagement> <dependencies> <dependency> <groupId>edu.utdallas.mavs.divas</groupId> <artifactId>divas-utils</artifactId> <version>${divas.version}</version> </dependency> <dependency> <groupId>edu.utdallas.mavs.divas</groupId> <artifactId>divas-mts</artifactId> <version>${divas.version}</version> </dependency> <dependency> <groupId>edu.utdallas.mavs.divas</groupId> <artifactId>divas-core</artifactId> <version>${divas.version}</version> </dependency> <dependency> <groupId>edu.utdallas.mavs.divas</groupId> <artifactId>divas-visualization</artifactId> <version>${divas.version}</version> </dependency> <dependency> <groupId>edu.utdallas.mavs.divas</groupId> <artifactId>evacuation-visualization</artifactId> <version>${divas.version}</version> </dependency> <dependency> <groupId>edu.utdallas.mavs.divas</groupId> <artifactId>evacuation-gui</artifactId> <version>${divas.version}</version> </dependency> <dependency> <groupId>edu.utdallas.mavs.divas</groupId> <artifactId>divas-gui</artifactId> <version>${divas.version}</version> </dependency> <dependency> <groupId>edu.utdallas.mavs.divas</groupId> <artifactId>evacuation-simulation</artifactId> <version>${divas.version}</version> </dependency> </dependencies> </dependencyManagement> <!-- ======================================= --> <!-- ==== UTD repository === --> <!-- ======================================= --> <repositories> <repository> <id>utdrepository</id> <url>http://www.utdmavs.org/divas4/m2/repository</url> </repository> </repositories> <!-- ======================================= --> <!-- ==== Reports === --> <!-- ======================================= --> <reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>2.8.1</version> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>versions-maven-plugin</artifactId> <version>1.3.1</version> <reportSets> <reportSet> <reports> <report>dependency-updates-report</report> <report>plugin-updates-report</report> <report>property-updates-report</report> </reports> </reportSet> </reportSets> </plugin> </plugins> </reporting> <!-- ======================================= --> <!-- ==== Build === --> <!-- ======================================= --> <build> <!-- Defines plugin versions --> <pluginManagement> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>2.5.1</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>2.8.1</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.12.3</version> </plugin> <plugin> <artifactId>maven-assembly-plugin</artifactId> <version>2.3</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>2.9.1</version> </plugin> <plugin> <artifactId>maven-antrun-plugin</artifactId> <version>1.7</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.5.1</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.4</version> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> </plugin> <!-- Ignore/Execute plugin execution --> <plugin> <groupId>org.eclipse.m2e</groupId> <artifactId>lifecycle-mapping</artifactId> <version>1.0.0</version> <configuration> <lifecycleMappingMetadata> <pluginExecutions> <!-- copy-dependency plugin --> <pluginExecution> <pluginExecutionFilter> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <versionRange>2.5.1</versionRange> <goals> <goal>unpack</goal> <goal>copy-dependencies</goal> </goals> </pluginExecutionFilter> <action> <ignore /> </action> </pluginExecution> </pluginExecutions> </lifecycleMappingMetadata> </configuration> </plugin> </plugins> </pluginManagement> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <configuration> <enableRulesSummary>false</enableRulesSummary> <configLocation>checkstyle.xml</configLocation> </configuration> </plugin> <plugin> <artifactId>maven-javadoc-plugin</artifactId> <executions> <execution> <id>attach-javadocs</id> <phase>deploy</phase> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> </plugins> </build>
- Finally, refresh the maven project. Right click the “evacuation” project in the project explorer > Maven > Update Project Make sure “Force Update of Snapshots/Releases” is checked and press “OK”.
- To better understand the project’s structure and how its inner packages are decomposed, we change the project and package presentations to a hierarchical view. We can do this by:
-