<?xml version="1.0"?>
<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>org.jitsi</groupId>
  <artifactId>jitsi-videobridge</artifactId>
  <version>2.1-SNAPSHOT</version>
  <packaging>jar</packaging>
  <name>jitsi-videobridge</name>
  <url>https://github.com/jitsi/jitsi-videobridge</url>
  <properties>
    <assembly.skipAssembly>false</assembly.skipAssembly>
    <exec.mainClass>org.jitsi.videobridge.Main</exec.mainClass>
    <jetty.version>9.4.15.v20190215</jetty.version>
    <kotlin.version>1.3.71</kotlin.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <smack.version>4.2.4-47d17fc</smack.version>
    <jicoco.version>1.1-28-gf83a3d3</jicoco.version>
    <jitsi.utils.version>1.0-47-gdb30505</jitsi.utils.version>
    <maven-shade-plugin.version>3.2.2</maven-shade-plugin.version>
    <spotbugs.version>4.0.1</spotbugs.version>
    <jersey.version>2.30.1</jersey.version>
  </properties>

  <profiles>
    <profile>
      <!-- Building a fat jar is disabled by default. To build it
           pass '-P buildFatJar'
      -->
      <id>buildFatJar</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>${maven-shade-plugin.version}</version>
            <executions>
              <execution>
                <id>build-fat-jar</id>
                <phase>package</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <dependencyManagement>
    <dependencies>
    </dependencies>
  </dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>com.googlecode.json-simple</groupId>
      <artifactId>json-simple</artifactId>
      <version>1.1.1</version>
      <!-- json-simple 1.1.1 incorrectly listed junit as a compile dependency rather than a test dependency.
	   This has been fixed in its github repo but a new release hasn't been pushed to maven. -->
      <exclusions>
        <exclusion>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>dom4j</groupId>
      <artifactId>dom4j</artifactId>
      <version>1.6.1</version>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>28.2-jre</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-rewrite</artifactId>
      <version>${jetty.version}</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-servlets</artifactId>
      <version>${jetty.version}</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty.websocket</groupId>
      <artifactId>websocket-server</artifactId>
      <version>${jetty.version}</version>
    </dependency>
    <dependency>
      <groupId>org.igniterealtime</groupId>
      <artifactId>tinder</artifactId>
      <version>1.3.0</version>
    </dependency>
    <dependency>
      <groupId>org.igniterealtime.smack</groupId>
      <artifactId>smack-extensions</artifactId>
      <version>${smack.version}</version>
    </dependency>
    <dependency>
      <groupId>org.igniterealtime.whack</groupId>
      <artifactId>core</artifactId>
      <version>2.0.1</version>
    </dependency>
    <dependency>
      <groupId>org.jetbrains</groupId>
      <artifactId>annotations</artifactId>
      <version>15.0</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/com.github.spotbugs/spotbugs-annotations -->
    <dependency>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-annotations</artifactId>
        <version>${spotbugs.version}</version>
    </dependency>
    <!-- org.jitsi -->
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>jitsi-media-transform</artifactId>
      <version>1.0-155-gb6af7e9</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>rtp</artifactId>
      <version>1.0-46-gd3742d1</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>sctp</artifactId>
      <version>1.0-20190319.172750-1</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
    <!-- we inherit an old version of slf4j-api from tinder, which pcap4j doesn't work with. Adding slf4j-api 1.7.30 (the current stable) as a dep of jvb fixes the problem. -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>1.7.30</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>ice4j</artifactId>
      <version>3.0-14-g7016902</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>jicoco</artifactId>
      <version>${jicoco.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>jicoco-kotlin</artifactId>
      <version>${jicoco.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>jitsi-android-osgi</artifactId>
      <version>1.0-20190327.160432-3</version>
    </dependency>
    <!-- Note that this is not part of jitsi/jitsi, and it has a separate version. -->
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>jitsi-stats</artifactId>
      <version>1.0-3-gd5cc199</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>jitsi-xmpp-extensions</artifactId>
      <version>1.0-8-g340be56</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>jitsi-utils</artifactId>
      <version>${jitsi.utils.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>jitsi-utils-kotlin</artifactId>
      <version>${jitsi.utils.version}</version>
    </dependency>
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>org.osgi.core</artifactId>
      <version>4.3.1</version>
    </dependency>
    <dependency>
      <groupId>xpp3</groupId>
      <artifactId>xpp3</artifactId>
      <version>1.1.4c</version>
    </dependency>
    <dependency>
      <groupId>org.jetbrains.kotlin</groupId>
      <artifactId>kotlin-stdlib-jdk8</artifactId>
      <version>${kotlin.version}</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jersey.containers</groupId>
      <artifactId>jersey-container-jetty-http</artifactId>
      <version>${jersey.version}</version>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jersey.containers</groupId>
      <artifactId>jersey-container-servlet</artifactId>
      <version>${jersey.version}</version>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jersey.inject</groupId>
      <artifactId>jersey-hk2</artifactId>
      <version>${jersey.version}</version>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jersey.media</groupId>
      <artifactId>jersey-media-json-jackson</artifactId>
      <version>${jersey.version}</version>
    </dependency>
    <dependency>
      <groupId>org.reflections</groupId>
      <artifactId>reflections</artifactId>
      <version>0.9.11</version>
    </dependency>
    <!-- runtime -->
    <dependency>
      <groupId>rusv</groupId>
      <artifactId>agafua-syslog</artifactId>
      <version>0.4</version>
      <scope>runtime</scope>
    </dependency>
    <!-- test -->
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <version>3.3.3</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.easymock</groupId>
      <artifactId>easymock</artifactId>
      <version>4.0.2</version>
      <scope>test</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.powermock/powermock-core -->
    <dependency>
      <groupId>org.powermock</groupId>
      <artifactId>powermock-core</artifactId>
      <version>2.0.6</version>
      <scope>test</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.powermock/powermock-api-easymock -->
    <dependency>
      <groupId>org.powermock</groupId>
      <artifactId>powermock-api-easymock</artifactId>
      <version>2.0.6</version>
      <scope>test</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.powermock/powermock-module-junit4 -->
    <dependency>
      <groupId>org.powermock</groupId>
      <artifactId>powermock-module-junit4</artifactId>
      <version>2.0.6</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jersey.test-framework</groupId>
      <artifactId>jersey-test-framework-core</artifactId>
      <version>${jersey.version}</version>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jersey.test-framework.providers</groupId>
      <artifactId>jersey-test-framework-provider-jetty</artifactId>
      <version>${jersey.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jersey.test-framework.providers</groupId>
      <artifactId>jersey-test-framework-provider-grizzly2</artifactId>
      <version>${jersey.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>
    <!-- We need this so that maven-surefire-plugin can run junit4 tests -->
    <dependency>
      <groupId>org.junit.vintage</groupId>
      <artifactId>junit-vintage-engine</artifactId>
      <version>5.5.2</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.kotlintest</groupId>
      <artifactId>kotlintest-runner-junit5</artifactId>
      <version>3.4.2</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jitsi</groupId>
      <artifactId>jicoco-test-kotlin</artifactId>
      <version>${jicoco.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>3.0.0-M3</version>
        <executions>
          <execution>
            <id>enforce-maven</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireMavenVersion>
                  <version>3.5.0</version>
                </requireMavenVersion>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
         <version>3.2.0</version>
         <executions>
           <execution>
             <id>assemble-archive</id>
             <phase>package</phase>
             <goals>
               <goal>single</goal>
             </goals>
             <configuration>
               <appendAssemblyId>true</appendAssemblyId>
               <descriptors>
                 <descriptor>src/assembly/archive.xml</descriptor>
               </descriptors>
               <skipAssembly>${assembly.skipAssembly}</skipAssembly>
             </configuration>
           </execution>
         </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>${maven-shade-plugin.version}</version>
        <executions>
          <execution>
            <id>build-fat-jar</id>
            <goals>
              <goal>shade</goal>
            </goals>
            <!-- Building a fat jar is disabled by default.  See the note
                 on the buildFatJar profile at the top of this file
            -->
            <phase>none</phase>
            <configuration>
              <finalName>${project.name}-${project.version}-jar-with-dependencies</finalName>
              <transformers>
                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                  <resource>reference.conf</resource>
                </transformer>
              </transformers>
              <filters>
                <filter>
                  <artifact>*:*</artifact>
                  <!-- Exclude signatures as they don't work correctly with a
                       fat jar.
                  -->
                  <excludes>
                    <exclude>META-INF/*.SF</exclude>
                    <exclude>META-INF/*.DSA</exclude>
                    <exclude>META-INF/*.RSA</exclude>
                  </excludes>
                </filter>
              </filters>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.6.0</version>
        <executions>
          <execution>
            <id>exec-exec</id>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <executable>java</executable>
              <arguments>
                <argument>-classpath</argument>
                <classpath/>
                <argument>-Djava.util.logging.config.file=${project.basedir}/lib/logging.properties</argument>
                <argument>${exec.mainClass}</argument>
              </arguments>
            </configuration>
          </execution>
          <execution>
            <id>exec-java</id>
            <goals>
              <goal>java</goal>
            </goals>
            <configuration>
              <mainClass>${exec.mainClass}</mainClass>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>${jetty.version}</version>
      </plugin>
      <plugin>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-maven-plugin</artifactId>
        <version>${kotlin.version}</version>
        <executions>
          <execution>
            <id>compile</id>
            <phase>compile</phase>
            <goals>
              <goal>compile</goal>
            </goals>
            <configuration>
              <sourceDirs>
                <sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
                <sourceDir>${project.basedir}/src/main/java</sourceDir>
              </sourceDirs>
            </configuration>
          </execution>
          <execution>
            <id>test-compile</id>
            <phase>test-compile</phase>
            <goals>
              <goal>test-compile</goal>
            </goals>
            <configuration>
              <sourceDirs>
                <sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
                <sourceDir>${project.basedir}/src/test/java</sourceDir>
              </sourceDirs>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <jvmTarget>1.8</jvmTarget>
          <args>
            <arg>-Xallow-result-return-type</arg>
          </args>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <executions>
          <!-- Replacing default-compile as it is treated specially by maven -->
          <execution>
            <id>default-compile</id>
            <phase>none</phase>
          </execution>
          <!-- Replacing default-testCompile as it is treated specially by maven -->
          <execution>
            <id>default-testCompile</id>
            <phase>none</phase>
          </execution>
          <execution>
            <id>java-compile</id>
            <phase>compile</phase>
            <goals>
              <goal>compile</goal>
            </goals>
          </execution>
          <execution>
            <id>java-test-compile</id>
            <phase>test-compile</phase>
            <goals>
              <goal>testCompile</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
          <compilerArgs>
            <arg>-Xlint:all</arg>
          </compilerArgs>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.22.2</version>
        <configuration>
          <reuseForks>false</reuseForks>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-maven-plugin</artifactId>
        <version>4.0.0</version>
        <configuration>
          <excludeFilterFile>spotbugs-exclude.xml</excludeFilterFile>
          <includeTests>true</includeTests>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>com.github.spotbugs</groupId>
            <artifactId>spotbugs</artifactId>
            <version>${spotbugs.version}</version>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.8</version>
        <executions>
          <execution>
            <id>ktlint</id>
            <phase>verify</phase>
            <configuration>
              <target name="ktlint">
                <java taskname="ktlint" dir="${basedir}" fork="true" failonerror="true"
                      classpathref="maven.plugin.classpath" classname="com.pinterest.ktlint.Main">
                  <arg value="src/**/*.kt"/>
                  <!-- to generate report in checkstyle format prepend following args: -->
                  <!--
                  <arg value="[dash][dash]reporter=plain"/>
                  <arg value="[dash][dash]reporter=checkstyle,output=${project.build.directory}/ktlint.xml"/>
                  -->
                  <!-- see https://github.com/shyiko/ktlint#usage for more -->
                </java>
              </target>
            </configuration>
            <goals><goal>run</goal></goals>
          </execution>
          <execution>
            <id>ktlint-format</id>
            <configuration>
              <target name="ktlint">
                <java taskname="ktlint" dir="${basedir}" fork="true" failonerror="true"
                      classpathref="maven.plugin.classpath" classname="com.pinterest.ktlint.Main">
                  <arg value="-F"/>
                  <arg value="src/**/*.kt"/>
                </java>
              </target>
            </configuration>
            <goals><goal>run</goal></goals>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>com.pinterest</groupId>
            <artifactId>ktlint</artifactId>
            <version>0.36.0</version>
          </dependency>
          <!-- additional 3rd party ruleset(s) can be specified here -->
        </dependencies>
      </plugin>
      <plugin>
        <!-- Instructs the plugin to add the current package version in the jar manifest
        So we can access it runtime with: .class.getPackage().getImplementationVersion()
         -->
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>3.2.0</version>
        <configuration>
          <archive>
            <manifest>
              <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
            </manifest>
          </archive>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <repositories>
    <repository>
      <id>jitsi-maven-repository-releases</id>
      <layout>default</layout>
      <name>Jitsi Maven Repository (Releases)</name>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <url>https://github.com/jitsi/jitsi-maven-repository/raw/master/releases/</url>
    </repository>
    <repository>
      <id>jitsi-maven-repository-snapshots</id>
      <layout>default</layout>
      <name>Jitsi Maven Repository (Snapshots)</name>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
      <url>https://github.com/jitsi/jitsi-maven-repository/raw/master/snapshots/</url>
    </repository>
  </repositories>
</project>
