<?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/maven-v4_0_0.xsd">
	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<maven.compiler.source>17</maven.compiler.source>
		<maven.compiler.target>17</maven.compiler.target>
	</properties>
	<modelVersion>4.0.0</modelVersion>
	<groupId>org.mphillips.railtrackr</groupId>
	<artifactId>server</artifactId>
	<packaging>war</packaging>
	<version>1.0-SNAPSHOT</version>
	<name>RT Server</name>
	<url>https://railtrackr.mphillips.org</url>
	<prerequisites>
		<maven>3.8</maven>
	</prerequisites>

	<dependencies>
		<dependency>
			<groupId>org.mphillips.railtrackr</groupId>
			<artifactId>RT-Layout</artifactId>
			<version>1.2-SNAPSHOT</version>
			<classifier>resources</classifier>
			<type>zip</type>
		</dependency>
		<dependency>
			<groupId>joda-time</groupId>
			<artifactId>joda-time</artifactId>
			<version>2.12.5</version>
		</dependency>
		<dependency>
			<groupId>jakarta.servlet</groupId>
			<artifactId>jakarta.servlet-api</artifactId>
			<version>6.0.0</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>jakarta.platform</groupId>
			<artifactId>jakarta.jakartaee-api</artifactId>
			<version>10.0.0</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>jakarta.websocket</groupId>
			<artifactId>jakarta.websocket-api</artifactId>
			<version>2.1.0</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-dbcp2</artifactId>
			<version>2.11.0</version>
		</dependency>
		<dependency>
			<groupId>net.ser1.stomp</groupId>
			<artifactId>gozirra</artifactId>
			<version>1.0.8</version>
		</dependency>
		<dependency>
			<groupId>com.mysql</groupId>
			<artifactId>mysql-connector-j</artifactId>
			<version>8.0.33</version>
		</dependency>
		<dependency>
			<groupId>com.h2database</groupId>
			<artifactId>h2</artifactId>
			<version>2.2.224</version>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>2.0.9</version>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-simple</artifactId>
			<version>2.0.9</version>
		</dependency>
		<dependency>
			<groupId>org.apache.activemq</groupId>
			<artifactId>activemq-client</artifactId>
			<version>6.0.1</version>
		</dependency>
		<dependency>
			<groupId>jakarta.jms</groupId>
			<artifactId>jakarta.jms-api</artifactId>
			<version>3.1.0</version>
		</dependency>
        <dependency>
            <groupId>jakarta.json</groupId>
            <artifactId>jakarta.json-api</artifactId>
            <version>2.1.3</version>
        </dependency>
		<dependency>
			<groupId>org.eclipse.parsson</groupId>
			<artifactId>parsson</artifactId>
			<version>1.1.5</version>
		</dependency>
		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter</artifactId>
			<version>5.10.2</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.mockito</groupId>
			<artifactId>mockito-core</artifactId>
			<version>5.14.2</version>
			<scope>test</scope>
		</dependency>
    </dependencies>
	<build>
		<resources>
			<resource>
				<directory>res</directory>
			</resource>
		</resources>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<version>3.2.5</version>
				<configuration>
					<!-- Loads Mockito as an agent up front, so it does not attach itself to the running JVM (which newer JDKs warn about and will disallow) -->
					<!-- net.bytebuddy.experimental lets Byte Buddy handle class files from JDKs newer than it knows about -->
					<argLine>-javaagent:${org.mockito:mockito-core:jar} -Dnet.bytebuddy.experimental=true</argLine>
					<systemPropertyVariables>
						<!-- DBHandler picks its SQL dialect from this, and the database tests run on H2 -->
						<org.mphillips.railtrackr.client.jettyEmbedded>true</org.mphillips.railtrackr.client.jettyEmbedded>
					</systemPropertyVariables>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-enforcer-plugin</artifactId>
				<version>3.4.1</version>
				<executions>
					<execution>
						<id>enforce-maven</id>
						<goals>
							<goal>enforce</goal>
						</goals>
						<configuration>
							<rules>
								<requireMavenVersion>
									<version>3.8</version>
								</requireMavenVersion>
							</rules>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<version>3.4.0</version>
				<configuration>
					<webResources>
						<resource>
							<directory>${project.build.directory}/generated-resources</directory>
							<include>signals.json</include>
						</resource>
						<resource>
							<directory>${project.build.directory}/generated-resources</directory>
							<include>tracks.txt</include>
						</resource>
					</webResources>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.eclipse.jetty</groupId>
				<artifactId>jetty-maven-plugin</artifactId>
				<version>11.0.18</version>
				<configuration>
					<useTestScope>true</useTestScope>
    				<systemProperties>
						<systemProperty>
							<name>org.mphillips.railtrackr.client.jettyEmbedded</name>
							<value>true</value>
						</systemProperty>
					</systemProperties>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<version>3.6.1</version>
				<executions>
					<execution>
						<!-- Sets ${org.mockito:mockito-core:jar} to the path of Mockito's jar, for the -javaagent in Surefire's argLine -->
						<id>mockito-agent-path</id>
						<goals>
							<goal>properties</goal>
						</goals>
					</execution>
					<execution>
						<id>unpack-shared-resources</id>
						<goals>
							<goal>unpack-dependencies</goal>
						</goals>
						<phase>generate-resources</phase>
						<configuration>
							<outputDirectory>${project.build.directory}/generated-resources</outputDirectory>
							<includeArtifactIds>RT-Layout</includeArtifactIds>
							<includeGroupIds>org.mphillips.railtrackr</includeGroupIds>
							<excludeTransitive>true</excludeTransitive>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>exec-maven-plugin</artifactId>
				<version>3.1.1</version>
				<executions>
					<execution>
						<id>python-build</id>
						<phase>generate-resources</phase>
						<goals>
							<goal>exec</goal>
						</goals>
						<configuration>
							<executable>python</executable>
							<workingDirectory>scripts/</workingDirectory>
							<arguments>
								<argument>signalJson.py</argument>
								<argument>${project.build.directory}/generated-resources/signals</argument>
								<argument>${project.build.directory}/generated-resources/routes</argument>
								<argument>${project.build.directory}/generated-resources/signals.json</argument>
							</arguments>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<artifactId>maven-antrun-plugin</artifactId>
				<version>3.1.0</version>
				<executions>
					<execution>
						<id>default-cli</id>
						<phase>generate-resources</phase>
						<goals>
							<goal>run</goal>
						</goals>
						<configuration>
							<target>
								<concat destfile="${project.build.directory}/generated-resources/tracks.txt" force="yes">
									<fileset dir="${project.build.directory}/generated-resources/tracks">
										<!--include name="*"></include-->
									</fileset>
									<filterchain>
										<deletecharacters chars="\t "/>
									</filterchain>
								</concat>
							</target>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<artifactId>maven-resources-plugin</artifactId>
				<version>3.3.1</version>
				<executions>
					<execution>
						<id>copy-resources</id>
						<phase>process-resources</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<outputDirectory>${project.build.directory}/generated-resources</outputDirectory>
							<resources>
								<resource>
									<directory>src/non-packaged-resources</directory>
									<filtering>true</filtering>
								</resource>
							</resources>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
		<!--resources>
			<resource>
				<directory>${project.build.directory}/generated-resources</directory>
				<filtering>true</filtering>
			</resource>
			<resource>
				<directory>src/main/resources</directory>
			</resource>
		</resources-->
	</build>
	<distributionManagement>
		<snapshotRepository>
			<id>mphillips.snapshots</id>
			<url>https://maven.mphillips.org/snapshots</url>
		</snapshotRepository>
		<repository>
			<id>mphillips.releases</id>
			<url>https://maven.mphillips.org/releases</url>
		</repository>
	</distributionManagement>
	<repositories>
		<repository>
			<snapshots>
				<enabled>true</enabled>
				<updatePolicy>always</updatePolicy>
				<checksumPolicy>fail</checksumPolicy>
			</snapshots>
			<id>mphillips.snapshots</id>
			<name>mphillips.org/snapshots</name>
			<url>https://maven.mphillips.org/snapshots</url>
		</repository>
		<repository>
			<releases>
				<enabled>true</enabled>
				<updatePolicy>always</updatePolicy>
				<checksumPolicy>fail</checksumPolicy>
			</releases>
			<id>mphillips.releases</id>
			<name>mphillips.org/releases</name>
			<url>https://maven.mphillips.org/releases</url>
		</repository>
	</repositories>
	<profiles>
		<profile>
			<id>local-deploy</id>
			<activation>
				<activeByDefault>false</activeByDefault>
			</activation>
			<distributionManagement>
				<snapshotRepository>
					<id>local-repository</id>
					<url>file:///var/www/maven/snapshots</url>
				</snapshotRepository>
				<repository>
					<id>local-repository</id>
					<url>file:///var/www/maven/releases</url>
				</repository>
			</distributionManagement>
		</profile>
	</profiles>
</project>
