Example pom.xml

Last updated on 26th March 2024

The Simudyne SDK often requires a pom.xml file in order to be built, run, packaged, and more via Maven. Below is a sample, but verbose pom.xml file for you to make usage of. Note this includes both the ability to package to deploy to a single jar file for both running/deployment from said jar for Spark, or to deploy to a Docker container. It also contains all active Simudyne modules.

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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>simudyne</groupId>
    <artifactId>simudyne-maven-java</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <simudyne.version>2.5.2</simudyne.version>
    </properties>

    <repositories>
        <repository>
            <id>simudyne.jfrog.io</id>
            <name>simudyne.jfrog.io</name>
            <url>https://simudyne.jfrog.io/simudyne/releases</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>simudyne</groupId>
            <artifactId>simudyne-nexus-server_2.12</artifactId>
            <version>${simudyne.version}</version>
        </dependency>
        <dependency>
            <groupId>simudyne</groupId>
            <artifactId>simudyne-core_2.12</artifactId>
            <version>${simudyne.version}</version>
        </dependency>
        <dependency>
            <groupId>simudyne</groupId>
            <artifactId>simudyne-core-abm_2.12</artifactId>
            <version>${simudyne.version}</version>
        </dependency>
        <dependency>
            <groupId>simudyne</groupId>
            <artifactId>simudyne-core-graph_2.12</artifactId>
            <version>${simudyne.version}</version>
        </dependency>
        <dependency>
            <groupId>simudyne</groupId>
            <artifactId>simudyne-core-abm-testkit_2.12</artifactId>
            <version>${simudyne.version}</version>
        </dependency>
		<dependency>
            <groupId>simudyne</groupId>
            <artifactId>simudyne-core-abm-finkit_2.12</artifactId>
            <version>${simudyne.version}</version>
        </dependency>
		<dependency>
			<groupId>simudyne</groupId>
			<artifactId>simudyne-core-graph-spark_2.12</artifactId>
			<version>${simudyne.version}</version>
		</dependency>
		<dependency>
			<groupId>simudyne</groupId>
			<artifactId>simudyne-core-runner-spark_2.12</artifactId>
			<version>${simudyne.version}</version>
		</dependency>
		<dependency>
            <groupId>simudyne</groupId>
            <artifactId>simudyne-core-sdm_2.12</artifactId>
            <version>${simudyne.version}</version>
        </dependency>
		
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.25</version>
        </dependency>
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-common</artifactId>
            <version>2.7.5</version>
        </dependency>
        <dependency>
            <groupId>org.apache.avro</groupId>
            <artifactId>avro</artifactId>
            <version>1.8.2</version>
        </dependency>

        <!--test dependencies-->

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>2.10.0</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.2.1</version>
        <configuration>
          <mainClass>Main</mainClass>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>3.1.0</version>
        <configuration>
          <artifactSet>
            <excludes>
              <exclude>META-INF/*</exclude>
              <exclude>com.fasterxml.jackson.core:jackson-databind</exclude>
              <exclude>com.fasterxml.jackson.module:jackson-module-scala_2.11</exclude>
              <exclude>com.twitter:chill_2.11</exclude>
              <exclude>io.netty:netty-all</exclude>
              <exclude>org.apache.commons:commons-math3</exclude>
              <exclude>org.apache.commons:commons-lang3</exclude>
              <exclude>org.json4s:json4s-jackson_2.11</exclude>
              <exclude>commons-net</exclude>
              <exclude>org.slf4j:slf4j-api</exclude>
              <exclude>org.xerial.snappy:snappy-java</exclude>
              <exclude>org.scala-lang:scala-library</exclude>
            </excludes>
          </artifactSet>
          <transformers>
            <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
              <resource>reference.conf</resource>
            </transformer>
          </transformers>
          <relocations>
            <relocation>
              <pattern>org.json4s</pattern>
              <shadedPattern>shaded.json4s</shadedPattern>
            </relocation>
            <relocation>
              <pattern>org.apache.avro</pattern>
              <shadedPattern>org.shaded.apache.avro</shadedPattern>
            </relocation>
          </relocations>
        </configuration>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>