<?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">
  <parent>
    <artifactId>jetty-unixsocket</artifactId>
    <groupId>org.eclipse.jetty</groupId>
    <version>11.0.15</version>
  </parent>

  <modelVersion>4.0.0</modelVersion>
  <artifactId>jetty-unixsocket-server</artifactId>
  <name>Jetty :: UnixSocket :: Server</name>

  <properties>
    <bundle-symbolic-name>${project.groupId}.unixsocket.server</bundle-symbolic-name>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-unixsocket-common</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-server</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-slf4j-impl</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>build-deps-file</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>list</goal>
            </goals>
            <configuration>
              <appendOutput>false</appendOutput>
              <outputFile>${project.build.directory}/deps.txt</outputFile>
              <sort>true</sort>
              <excludeGroupIds>org.eclipse.jetty,javax.servlet,org.slf4j</excludeGroupIds>
              <prependGroupId>true</prependGroupId>
              <includeScope>runtime</includeScope>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>process-deps</id>
            <phase>process-resources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <copy file="${project.build.directory}/deps.txt" tofile="${project.build.directory}/deps-orig.txt" />
                <!-- regex the deps with classifiers first -->
                <replaceregexp file="${project.build.directory}/deps.txt" match=" *(.*):(.*):jar:(.*):(.*):.*$" replace="maven://\1/\2/\4/jar/\3|lib/jnr/\2-\4-\3.jar" byline="true" />
                <!-- regex the normal deps -->
                <replaceregexp file="${project.build.directory}/deps.txt" match=" *(.*):(.*):jar:(.*):.*$" replace="maven://\1/\2/\3|lib/jnr/\2-\3.jar" byline="true" />
                <replaceregexp file="${project.build.directory}/deps.txt" match="The following files have been resolved:" replace="[files]" />
                <concat destfile="${project.build.directory}/unixsocket.mod">
                  <fileset file="${project.build.directory}/jetty-config-files/modules/unixsocket-prefix.mod" />
                  <fileset file="${project.build.directory}/deps.txt" />
                  <fileset file="${project.build.directory}/jetty-config-files/modules/unixsocket-suffix.mod" />
                </concat>
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
