<commit_before><?xml version="1.0"?>
<!--
  ~ Yet Another UserAgent Analyzer
  ~ Copyright (C) 2013-2022 <NAME>
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~ https://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<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>

  <parent>
    <artifactId>yauaa-parent</artifactId>
    <groupId>nl.basjes.parse.useragent</groupId>
    <version>7.3.1-SNAPSHOT</version>
  </parent>
  <artifactId>yauaa</artifactId>

  <name>Yauaa : Analyzer</name>
  <description>A parsing and analyzing library to get information from a useragent string.</description>

  <url>https://yauaa.basjes.nl</url>

  <properties>
    <Automatic-Module-Name>nl.basjes.parse.useragent</Automatic-Module-Name>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.antlr</groupId>
      <artifactId>antlr4-runtime</artifactId>
      <version>${antlr.version}</version>
    </dependency>

    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-core</artifactId>
      <version>${spring.version}</version>
    </dependency>

    <dependency>
      <groupId>org.yaml</groupId>
      <artifactId>snakeyaml</artifactId>
      <version>${snakeyaml.version}</version>
    </dependency>

    <dependency>
      <groupId>org.apache.httpcomponents.client5</groupId>
      <artifactId>httpclient5</artifactId>
      <version>5.1.3</version>
    </dependency>

    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-text</artifactId>
      <version>1.9</version>
      <exclusions>
        <exclusion>
          <groupId>org.apache.commons</groupId>
          <artifactId>commons-lang3</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>3.12.0</version>
    </dependency>

    <!-- Preferred caching library, needs Java 11+ -->
    <dependency>
      <groupId>com.github.ben-manes.caffeine</groupId>
      <artifactId>caffeine</artifactId>
      <version>3.1.1</version>
    </dependency>

    <!-- Used for a Java 8 compliant alternative to Caffeine. -->
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-collections4</artifactId>
      <version>${commons-collections4.version}</version>
    </dependency>

    <dependency>
      <groupId>nl.basjes.collections</groupId>
      <artifactId>prefixmap</artifactId>
      <version>2.0</version>
      <exclusions>
        <exclusion>
          <groupId>com.esotericsoftware</groupId>
          <artifactId>kryo</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <version>${lombok.version}</version>
      <scope>provided</scope>
    </dependency>

    <!-- The default logging implementation for Yauaa -->
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-core</artifactId>
      <version>${log4j2.version}</version>
      <scope>provided</scope>
    </dependency>

    <!-- Needed for the included classes from org.apache.httpcomponents.client5:httpclient5 -->
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-slf4j-impl</artifactId>
      <version>${log4j2.version}</version>
      <scope>provided</scope>
    </dependency>

    <!-- Needed for the included classes from org.springframework:spring-core -->
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-jcl</artifactId>
      <version>${log4j2.version}</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>com.esotericsoftware</groupId>
      <artifactId>kryo</artifactId>
      <version>${kryo5.version}</version>
      <optional>true</optional>
    </dependency>

    <dependency>
      <groupId>com.google.code.findbugs</groupId>
      <artifactId>jsr305</artifactId>
      <version>3.0.2</version>
    </dependency>

  </dependencies>

  <build>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>${maven-jar-plugin.version}</version>
        <configuration>
          <excludes>
            <exclude>UserAgents/*.sh</exclude>
            <exclude>UserAgents/**/*.sh</exclude>
            <exclude>UserAgents/**/*.csv</exclude>
            <exclude>UserAgents/**/*.txt</exclude>
            <exclude>UserAgents/**/*.tab</exclude>
            <exclude>UserAgents/**/*.md</exclude>
          </excludes>
          <archive>
            <manifestEntries>
              <Specification-Title>Yauaa: Yet Another UserAgent Analyzer</Specification-Title>
              <Specification-Version>${project.version}</Specification-Version>
              <Specification-Vendor>Niels Basjes</Specification-Vendor>
              <Implementation-Title>Yauaa: Yet Another UserAgent Analyzer</Implementation-Title>
              <Implementation-Version>${project.version}</Implementation-Version>
              <Implementation-Vendor>Niels Basjes</Implementation-Vendor>
              <Implementation-Vendor-Id>nl.basjes</Implementation-Vendor-Id>
              <Automatic-Module-Name>${Automatic-Module-Name}</Automatic-Module-Name>
              <url>${project.url}</url>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>

      <!-- Some of the dependencies (Antlr4, Spring and SnakeYaml) have proven to be problematic -->
      <!-- for downstream users who need different versions of these in the same application.    -->
      <!-- So for only these we include and relocate the used classes into the main jar.         -->
      <!-- Documentation of the used shading construct: https://yauaa.basjes.nl/NOTES-shading-dependencies.html -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>${maven-shade-plugin.version}</version>
        <configuration>
          <minimizeJar>true</minimizeJar>
          <createDependencyReducedPom>true</createDependencyReducedPom>
          <useDependencyReducedPomInJar>true</useDependencyReducedPomInJar>
          <filters>
            <filter>
              <artifact>org.antlr:antlr4-runtime</artifact>
              <excludes>
                <exclude>META-INF/services/**</exclude>
                <exclude>META-INF/MANIFEST.MF</exclude>
              </excludes>
            </filter>
            <filter>
              <artifact>org.springframework:spring-core</artifact>
              <excludes>
                <exclude>META-INF/services/**</exclude>
                <exclude>META-INF/MANIFEST.MF</exclude>
              </excludes>
            </filter>
            <filter>
              <artifact>org.yaml:snakeyaml</artifact>
              <excludes>
                <exclude>META-INF/services/**</exclude>
                <exclude>META-INF/MANIFEST.MF</exclude>
              </excludes>
            </filter>
          </filters>
          <relocations>
            <relocation>
              <pattern>org.springframework</pattern>
              <shadedPattern>nl.basjes.shaded.org.springframework</shadedPattern>
            </relocation>
            <relocation>
              <pattern>org.antlr</pattern>
              <shadedPattern>nl.basjes.shaded.org.antlr</shadedPattern>
            </relocation>
            <relocation>
              <pattern>org.yaml.snakeyaml</pattern>
              <shadedPattern>nl.basjes.shaded.org.yaml.snakeyaml</shadedPattern>
            </relocation>
          </relocations>
        </configuration>

        <executions>
          <execution>
            <id>inject-problematic-dependencies</id>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <artifactSet>
                <includes>
                  <include>org.antlr:antlr4-runtime</include>
                  <include>org.springframework:spring-core</include>
                  <include>org.yaml:snakeyaml</include>
                </includes>
              </artifactSet>
            </configuration>
          </execution>

        </executions>
      </plugin>

      <plugin>
        <groupId>com.alexecollins.maven.plugin</groupId>
        <artifactId>script-maven-plugin</artifactId>
        <version>${script-maven-plugin.version}</version>
        <executions>
          <execution>
            <id>Verify jar contents to ensure the shading of dependencies went right</id>
            <phase>verify</phase>
            <goals>
              <goal>execute</goal>
            </goals>

            <configuration>
              <language>beanshell</language>
              <script>
                import java.io.*;
                import java.util.jar.*;
                import java.util.Arrays;
                import org.codehaus.plexus.util.*;

                System.out.println("Verifying if the shading went correctly");

                String[] libraryWanted = {
                  "nl/basjes/parse/useragent/utils/YauaaVersion.class",
                  "nl/basjes/shaded/org/antlr/v4/runtime/Parser.class",
                  "nl/basjes/shaded/org/springframework/core/io/support/PathMatchingResourcePatternResolver.class",
                };

                String[] libraryUnwanted = {
                  "org/antlr/v4/runtime/Parser.class",
                  "org/springframework/core/io/support/PathMatchingResourcePatternResolver.class",
                  "org/slf4j/LoggerFactory.class",
                };

                JarFile libraryJarFile = new JarFile( new File( "${project.basedir}/target", "yauaa-${project.version}.jar" ) );

                for ( String path : libraryWanted ) {
                  if ( libraryJarFile.getEntry( path ) == null ) {
                    throw new IllegalStateException( "Library: wanted path is missing: " + path );
                  }
                }

                for ( String path : libraryUnwanted ) {
                  if ( libraryJarFile.getEntry( path ) != null ) {
                    throw new IllegalStateException( "Library: unwanted path is present: " + path );
                  }
                }
              </script>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>org.apache-extras.beanshell</groupId>
            <artifactId>bsh</artifactId>
            <version>2.0b6</version>
          </dependency>
        </dependencies>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>${exec-maven-plugin.version}</version>
        <executions>
          <execution>
            <id>Generate Matchers and Lookups</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <executable>./regen-all.sh</executable>
            </configuration>
          </execution>

          <execution>
            <id>Generate list of testcases</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <executable>./getTestCases.sh</executable>
            </configuration>
          </execution>

        </executions>
      </plugin>

      <plugin>
        <groupId>org.antlr</groupId>
        <artifactId>antlr4-maven-plugin</artifactId>
        <version>${antlr.version}</version>
        <executions>
          <execution>
            <id>antlr</id>
            <goals>
              <goal>antlr4</goal>
            </goals>
            <configuration>
              <visitor>true</visitor>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-maven-plugin</artifactId>
        <version>${spotbugs-maven-plugin.version}</version>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>${maven-checkstyle-plugin.version}</version>
      </plugin>

      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${jacoco-maven-plugin.version}</version>
        <configuration>
          <excludes>
            <!-- Generated classes -->
            <exclude>nl/basjes/parse/useragent/Version.class</exclude>
            <exclude>nl/basjes/parse/useragent/PackagedRules.class</exclude>
            <!-- Generated by ANTLR4 -->
            <exclude>nl/basjes/parse/useragent/parser/*.class</exclude>
            <!-- Developer debugging tools -->
            <exclude>nl/basjes/parse/useragent/debug/*.class</exclude>
          </excludes>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>${maven-antrun-plugin.version}</version>
        <executions>
          <execution>
            <phase>generate-sources</phase>
            <configuration>
              <target>
                <fileset id="packagedRules" dir="src/main/resources/UserAgents/" />
                <pathconvert targetos="unix" pathsep="&quot;,&#xD;        &quot;" property="my-file-list" refid="packagedRules">
                  <map from="${basedir}/src/main/resources/" to="" />
                </pathconvert>
                <!--suppress MavenModelInspection -->
                <echo file="${basedir}/target/temp-yaml-list.txt">${my-file-list}</echo>
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>com.google.code.maven-replacer-plugin</groupId>
        <artifactId>replacer</artifactId>
        <version>1.5.3</version>
        <executions>

          <execution>
            <id>Generate Version YAML</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>replace</goal>
            </goals>
            <configuration>
              <file>${basedir}/src/main/code-gen/version/Version.yaml.template</file>
              <regex>false</regex>
              <outputFile>${basedir}/target/classes/UserAgents/__Version__.yaml</outputFile>
            </configuration>
          </execution>

          <execution>
            <id>Generate Version Java</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>replace</goal>
            </goals>
            <configuration>
              <file>${basedir}/src/main/code-gen/version/Version.java.template</file>
              <regex>false</regex>
              <outputFile>${basedir}/target/generated-sources/java/nl/basjes/parse/useragent/Version.java</outputFile>
            </configuration>
          </execution>

          <execution>
            <id>Generate Yaml List Java</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>replace</goal>
            </goals>
            <configuration>
              <file>${basedir}/src/main/code-gen/UserAgents/PackagedRules.java.template</file>
              <regex>false</regex>
              <outputFile>${basedir}/target/generated-sources/java/nl/basjes/parse/useragent/PackagedRules.java</outputFile>
            </configuration>
          </execution>


          <execution>
            <id>Generate Preheat Java</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>replace</goal>
            </goals>
            <configuration>
              <file>${basedir}/src/main/code-gen/UserAgents/PreHeatCases.java.template</file>
              <regex>false</regex>
              <outputFile>${basedir}/target/generated-sources/java/nl/basjes/parse/useragent/PreHeatCases.java</outputFile>
            </configuration>
          </execution>

        </executions>
        <configuration>
          <replacements>
            <replacement>
              <!--suppress MavenModelInspection -->
              <token>@git.commit.id@</token>
              <!--suppress MavenModelInspection -->
              <value>${git.commit.id}</value>
            </replacement>
            <replacement>
              <!--suppress MavenModelInspection -->
              <token>@git.commit.id.describe-short@</token>
              <!--suppress MavenModelInspection -->
              <value>${git.commit.id.describe-short}</value>
            </replacement>
            <replacement>
              <token>@maven.build.timestamp@</token>
              <value>${maven.build.timestamp}</value>
            </replacement>
            <replacement>
              <token>@project.version@</token>
              <value>${project.version}</value>
            </replacement>
            <replacement>
              <token>@version.copyright@</token>
              <value>${version.copyright}</value>
            </replacement>
            <replacement>
              <token>@version.license@</token>
              <value>${version.license}</value>
            </replacement>
            <replacement>
              <token>@version.url@</token>
              <value>${version.url}</value>
            </replacement>
            <replacement>
              <token>@java.version@</token>
              <value>${java.version}</value>
            </replacement>
            <replacement>
              <token>@target.java.version@</token>
              <value>${target.java.version}</value>
            </replacement>
            <replacement>
              <token>###file-list###</token>
              <valueFile>${basedir}/target/temp-yaml-list.txt</valueFile>
            </replacement>
            <replacement>
              <token>###agents-list###</token>
              <valueFile>${basedir}/target/temp-agents-list.txt</valueFile>
            </replacement>

          </replacements>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>${build-helper-maven-plugin.version}</version>
        <executions>
          <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${project.build.directory}/generated-sources/java/</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- Always run integration tests -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-invoker-plugin</artifactId>
        <version>${maven-invoker-plugin.version}</version>
        <configuration>
          <failIfNoProjects>true</failIfNoProjects>
          <!--          <debug>true</debug>-->
          <streamLogsOnFailures>true</streamLogsOnFailures>
          <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
          <setupIncludes>
            <setupInclude>setup/*/pom.xml</setupInclude>
          </setupIncludes>
          <pomIncludes>
            <pomInclude>JavaPlain/*/pom.xml</pomInclude>
            <pomInclude>JavaJPMS/*/pom.xml</pomInclude>
            <pomInclude>Logging/*/pom.xml</pomInclude>
            <pomInclude>Serialization/*/pom.xml</pomInclude>
            <pomInclude>Examples/*/pom.xml</pomInclude>
          </pomIncludes>
          <postBuildHookScript>verify</postBuildHookScript>
          <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
          <settingsFile>./src/it/settings.xml</settingsFile>
          <goals>
            <goal>clean</goal>
            <goal>test</goal>
          </goals>
        </configuration>
        <executions>
          <execution>
            <id>integration-test</id>
            <goals>
              <goal>install</goal>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!--Configuration for periodic mutation testing.-->
      <plugin>
        <groupId>org.pitest</groupId>
        <artifactId>pitest-maven</artifactId>
        <version>1.9.3</version>
        <configuration>

          <threads>4</threads>
          <reportsDirectory>${project.basedir}/pitest/pit-reports</reportsDirectory>

          <historyInputFile>${project.basedir}/pitest/yauaa_pitest_history.bin</historyInputFile>
          <historyOutputFile>${project.basedir}/pitest/yauaa_pitest_history.bin</historyOutputFile>

          <timestampedReports>true</timestampedReports>

          <excludedMethods>
            <excludedMethod>toString</excludedMethod>
          </excludedMethods>

          <excludedClasses>
            <excludedClass>nl.basjes.parse.useragent.Version</excludedClass>
            <excludedGroup>nl.basjes.parse.useragent.parser.*</excludedGroup> <!-- Generated antlr4 code -->
            <excludedGroup>nl.basjes.parse.useragent.debug.*</excludedGroup>
          </excludedClasses>

          <avoidCallsTo>
            <avoidCallsTo>java.util.logging</avoidCallsTo>
            <avoidCallsTo>org.apache.log4j</avoidCallsTo>
            <avoidCallsTo>org.slf4j</avoidCallsTo>
            <avoidCallsTo>org.apache.commons.logging</avoidCallsTo>
          </avoidCallsTo><commit_msg>chore(deps): update dependency org.pitest:pitest-maven to v1.9.4<commit_after><?xml version="1.0"?>
<!--
  ~ Yet Another UserAgent Analyzer
  ~ Copyright (C) 2013-2022 <NAME>
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~ https://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<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>

  <parent>
    <artifactId>yauaa-parent</artifactId>
    <groupId>nl.basjes.parse.useragent</groupId>
    <version>7.3.1-SNAPSHOT</version>
  </parent>
  <artifactId>yauaa</artifactId>

  <name>Yauaa : Analyzer</name>
  <description>A parsing and analyzing library to get information from a useragent string.</description>

  <url>https://yauaa.basjes.nl</url>

  <properties>
    <Automatic-Module-Name>nl.basjes.parse.useragent</Automatic-Module-Name>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.antlr</groupId>
      <artifactId>antlr4-runtime</artifactId>
      <version>${antlr.version}</version>
    </dependency>

    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-core</artifactId>
      <version>${spring.version}</version>
    </dependency>

    <dependency>
      <groupId>org.yaml</groupId>
      <artifactId>snakeyaml</artifactId>
      <version>${snakeyaml.version}</version>
    </dependency>

    <dependency>
      <groupId>org.apache.httpcomponents.client5</groupId>
      <artifactId>httpclient5</artifactId>
      <version>5.1.3</version>
    </dependency>

    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-text</artifactId>
      <version>1.9</version>
      <exclusions>
        <exclusion>
          <groupId>org.apache.commons</groupId>
          <artifactId>commons-lang3</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>3.12.0</version>
    </dependency>

    <!-- Preferred caching library, needs Java 11+ -->
    <dependency>
      <groupId>com.github.ben-manes.caffeine</groupId>
      <artifactId>caffeine</artifactId>
      <version>3.1.1</version>
    </dependency>

    <!-- Used for a Java 8 compliant alternative to Caffeine. -->
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-collections4</artifactId>
      <version>${commons-collections4.version}</version>
    </dependency>

    <dependency>
      <groupId>nl.basjes.collections</groupId>
      <artifactId>prefixmap</artifactId>
      <version>2.0</version>
      <exclusions>
        <exclusion>
          <groupId>com.esotericsoftware</groupId>
          <artifactId>kryo</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <version>${lombok.version}</version>
      <scope>provided</scope>
    </dependency>

    <!-- The default logging implementation for Yauaa -->
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-core</artifactId>
      <version>${log4j2.version}</version>
      <scope>provided</scope>
    </dependency>

    <!-- Needed for the included classes from org.apache.httpcomponents.client5:httpclient5 -->
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-slf4j-impl</artifactId>
      <version>${log4j2.version}</version>
      <scope>provided</scope>
    </dependency>

    <!-- Needed for the included classes from org.springframework:spring-core -->
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-jcl</artifactId>
      <version>${log4j2.version}</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>com.esotericsoftware</groupId>
      <artifactId>kryo</artifactId>
      <version>${kryo5.version}</version>
      <optional>true</optional>
    </dependency>

    <dependency>
      <groupId>com.google.code.findbugs</groupId>
      <artifactId>jsr305</artifactId>
      <version>3.0.2</version>
    </dependency>

  </dependencies>

  <build>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>${maven-jar-plugin.version}</version>
        <configuration>
          <excludes>
            <exclude>UserAgents/*.sh</exclude>
            <exclude>UserAgents/**/*.sh</exclude>
            <exclude>UserAgents/**/*.csv</exclude>
            <exclude>UserAgents/**/*.txt</exclude>
            <exclude>UserAgents/**/*.tab</exclude>
            <exclude>UserAgents/**/*.md</exclude>
          </excludes>
          <archive>
            <manifestEntries>
              <Specification-Title>Yauaa: Yet Another UserAgent Analyzer</Specification-Title>
              <Specification-Version>${project.version}</Specification-Version>
              <Specification-Vendor><NAME></Specification-Vendor>
              <Implementation-Title>Yauaa: Yet Another UserAgent Analyzer</Implementation-Title>
              <Implementation-Version>${project.version}</Implementation-Version>
              <Implementation-Vendor><NAME></Implementation-Vendor>
              <Implementation-Vendor-Id>nl.basjes</Implementation-Vendor-Id>
              <Automatic-Module-Name>${Automatic-Module-Name}</Automatic-Module-Name>
              <url>${project.url}</url>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>

      <!-- Some of the dependencies (Antlr4, Spring and SnakeYaml) have proven to be problematic -->
      <!-- for downstream users who need different versions of these in the same application.    -->
      <!-- So for only these we include and relocate the used classes into the main jar.         -->
      <!-- Documentation of the used shading construct: https://yauaa.basjes.nl/NOTES-shading-dependencies.html -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>${maven-shade-plugin.version}</version>
        <configuration>
          <minimizeJar>true</minimizeJar>
          <createDependencyReducedPom>true</createDependencyReducedPom>
          <useDependencyReducedPomInJar>true</useDependencyReducedPomInJar>
          <filters>
            <filter>
              <artifact>org.antlr:antlr4-runtime</artifact>
              <excludes>
                <exclude>META-INF/services/**</exclude>
                <exclude>META-INF/MANIFEST.MF</exclude>
              </excludes>
            </filter>
            <filter>
              <artifact>org.springframework:spring-core</artifact>
              <excludes>
                <exclude>META-INF/services/**</exclude>
                <exclude>META-INF/MANIFEST.MF</exclude>
              </excludes>
            </filter>
            <filter>
              <artifact>org.yaml:snakeyaml</artifact>
              <excludes>
                <exclude>META-INF/services/**</exclude>
                <exclude>META-INF/MANIFEST.MF</exclude>
              </excludes>
            </filter>
          </filters>
          <relocations>
            <relocation>
              <pattern>org.springframework</pattern>
              <shadedPattern>nl.basjes.shaded.org.springframework</shadedPattern>
            </relocation>
            <relocation>
              <pattern>org.antlr</pattern>
              <shadedPattern>nl.basjes.shaded.org.antlr</shadedPattern>
            </relocation>
            <relocation>
              <pattern>org.yaml.snakeyaml</pattern>
              <shadedPattern>nl.basjes.shaded.org.yaml.snakeyaml</shadedPattern>
            </relocation>
          </relocations>
        </configuration>

        <executions>
          <execution>
            <id>inject-problematic-dependencies</id>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <artifactSet>
                <includes>
                  <include>org.antlr:antlr4-runtime</include>
                  <include>org.springframework:spring-core</include>
                  <include>org.yaml:snakeyaml</include>
                </includes>
              </artifactSet>
            </configuration>
          </execution>

        </executions>
      </plugin>

      <plugin>
        <groupId>com.alexecollins.maven.plugin</groupId>
        <artifactId>script-maven-plugin</artifactId>
        <version>${script-maven-plugin.version}</version>
        <executions>
          <execution>
            <id>Verify jar contents to ensure the shading of dependencies went right</id>
            <phase>verify</phase>
            <goals>
              <goal>execute</goal>
            </goals>

            <configuration>
              <language>beanshell</language>
              <script>
                import java.io.*;
                import java.util.jar.*;
                import java.util.Arrays;
                import org.codehaus.plexus.util.*;

                System.out.println("Verifying if the shading went correctly");

                String[] libraryWanted = {
                  "nl/basjes/parse/useragent/utils/YauaaVersion.class",
                  "nl/basjes/shaded/org/antlr/v4/runtime/Parser.class",
                  "nl/basjes/shaded/org/springframework/core/io/support/PathMatchingResourcePatternResolver.class",
                };

                String[] libraryUnwanted = {
                  "org/antlr/v4/runtime/Parser.class",
                  "org/springframework/core/io/support/PathMatchingResourcePatternResolver.class",
                  "org/slf4j/LoggerFactory.class",
                };

                JarFile libraryJarFile = new JarFile( new File( "${project.basedir}/target", "yauaa-${project.version}.jar" ) );

                for ( String path : libraryWanted ) {
                  if ( libraryJarFile.getEntry( path ) == null ) {
                    throw new IllegalStateException( "Library: wanted path is missing: " + path );
                  }
                }

                for ( String path : libraryUnwanted ) {
                  if ( libraryJarFile.getEntry( path ) != null ) {
                    throw new IllegalStateException( "Library: unwanted path is present: " + path );
                  }
                }
              </script>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>org.apache-extras.beanshell</groupId>
            <artifactId>bsh</artifactId>
            <version>2.0b6</version>
          </dependency>
        </dependencies>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>${exec-maven-plugin.version}</version>
        <executions>
          <execution>
            <id>Generate Matchers and Lookups</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <executable>./regen-all.sh</executable>
            </configuration>
          </execution>

          <execution>
            <id>Generate list of testcases</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <executable>./getTestCases.sh</executable>
            </configuration>
          </execution>

        </executions>
      </plugin>

      <plugin>
        <groupId>org.antlr</groupId>
        <artifactId>antlr4-maven-plugin</artifactId>
        <version>${antlr.version}</version>
        <executions>
          <execution>
            <id>antlr</id>
            <goals>
              <goal>antlr4</goal>
            </goals>
            <configuration>
              <visitor>true</visitor>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-maven-plugin</artifactId>
        <version>${spotbugs-maven-plugin.version}</version>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>${maven-checkstyle-plugin.version}</version>
      </plugin>

      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${jacoco-maven-plugin.version}</version>
        <configuration>
          <excludes>
            <!-- Generated classes -->
            <exclude>nl/basjes/parse/useragent/Version.class</exclude>
            <exclude>nl/basjes/parse/useragent/PackagedRules.class</exclude>
            <!-- Generated by ANTLR4 -->
            <exclude>nl/basjes/parse/useragent/parser/*.class</exclude>
            <!-- Developer debugging tools -->
            <exclude>nl/basjes/parse/useragent/debug/*.class</exclude>
          </excludes>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>${maven-antrun-plugin.version}</version>
        <executions>
          <execution>
            <phase>generate-sources</phase>
            <configuration>
              <target>
                <fileset id="packagedRules" dir="src/main/resources/UserAgents/" />
                <pathconvert targetos="unix" pathsep="&quot;,&#xD;        &quot;" property="my-file-list" refid="packagedRules">
                  <map from="${basedir}/src/main/resources/" to="" />
                </pathconvert>
                <!--suppress MavenModelInspection -->
                <echo file="${basedir}/target/temp-yaml-list.txt">${my-file-list}</echo>
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>com.google.code.maven-replacer-plugin</groupId>
        <artifactId>replacer</artifactId>
        <version>1.5.3</version>
        <executions>

          <execution>
            <id>Generate Version YAML</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>replace</goal>
            </goals>
            <configuration>
              <file>${basedir}/src/main/code-gen/version/Version.yaml.template</file>
              <regex>false</regex>
              <outputFile>${basedir}/target/classes/UserAgents/__Version__.yaml</outputFile>
            </configuration>
          </execution>

          <execution>
            <id>Generate Version Java</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>replace</goal>
            </goals>
            <configuration>
              <file>${basedir}/src/main/code-gen/version/Version.java.template</file>
              <regex>false</regex>
              <outputFile>${basedir}/target/generated-sources/java/nl/basjes/parse/useragent/Version.java</outputFile>
            </configuration>
          </execution>

          <execution>
            <id>Generate Yaml List Java</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>replace</goal>
            </goals>
            <configuration>
              <file>${basedir}/src/main/code-gen/UserAgents/PackagedRules.java.template</file>
              <regex>false</regex>
              <outputFile>${basedir}/target/generated-sources/java/nl/basjes/parse/useragent/PackagedRules.java</outputFile>
            </configuration>
          </execution>


          <execution>
            <id>Generate Preheat Java</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>replace</goal>
            </goals>
            <configuration>
              <file>${basedir}/src/main/code-gen/UserAgents/PreHeatCases.java.template</file>
              <regex>false</regex>
              <outputFile>${basedir}/target/generated-sources/java/nl/basjes/parse/useragent/PreHeatCases.java</outputFile>
            </configuration>
          </execution>

        </executions>
        <configuration>
          <replacements>
            <replacement>
              <!--suppress MavenModelInspection -->
              <token>@git.commit.id@</token>
              <!--suppress MavenModelInspection -->
              <value>${git.commit.id}</value>
            </replacement>
            <replacement>
              <!--suppress MavenModelInspection -->
              <token>@git.commit.id.describe-short@</token>
              <!--suppress MavenModelInspection -->
              <value>${git.commit.id.describe-short}</value>
            </replacement>
            <replacement>
              <token>@maven.build.timestamp@</token>
              <value>${maven.build.timestamp}</value>
            </replacement>
            <replacement>
              <token>@project.version@</token>
              <value>${project.version}</value>
            </replacement>
            <replacement>
              <token>@version.copyright@</token>
              <value>${version.copyright}</value>
            </replacement>
            <replacement>
              <token>@version.license@</token>
              <value>${version.license}</value>
            </replacement>
            <replacement>
              <token>@version.url@</token>
              <value>${version.url}</value>
            </replacement>
            <replacement>
              <token>@java.version@</token>
              <value>${java.version}</value>
            </replacement>
            <replacement>
              <token>@target.java.version@</token>
              <value>${target.java.version}</value>
            </replacement>
            <replacement>
              <token>###file-list###</token>
              <valueFile>${basedir}/target/temp-yaml-list.txt</valueFile>
            </replacement>
            <replacement>
              <token>###agents-list###</token>
              <valueFile>${basedir}/target/temp-agents-list.txt</valueFile>
            </replacement>

          </replacements>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>${build-helper-maven-plugin.version}</version>
        <executions>
          <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${project.build.directory}/generated-sources/java/</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- Always run integration tests -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-invoker-plugin</artifactId>
        <version>${maven-invoker-plugin.version}</version>
        <configuration>
          <failIfNoProjects>true</failIfNoProjects>
          <!--          <debug>true</debug>-->
          <streamLogsOnFailures>true</streamLogsOnFailures>
          <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
          <setupIncludes>
            <setupInclude>setup/*/pom.xml</setupInclude>
          </setupIncludes>
          <pomIncludes>
            <pomInclude>JavaPlain/*/pom.xml</pomInclude>
            <pomInclude>JavaJPMS/*/pom.xml</pomInclude>
            <pomInclude>Logging/*/pom.xml</pomInclude>
            <pomInclude>Serialization/*/pom.xml</pomInclude>
            <pomInclude>Examples/*/pom.xml</pomInclude>
          </pomIncludes>
          <postBuildHookScript>verify</postBuildHookScript>
          <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
          <settingsFile>./src/it/settings.xml</settingsFile>
          <goals>
            <goal>clean</goal>
            <goal>test</goal>
          </goals>
        </configuration>
        <executions>
          <execution>
            <id>integration-test</id>
            <goals>
              <goal>install</goal>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!--Configuration for periodic mutation testing.-->
      <plugin>
        <groupId>org.pitest</groupId>
        <artifactId>pitest-maven</artifactId>
        <version>1.9.4</version>
        <configuration>

          <threads>4</threads>
          <reportsDirectory>${project.basedir}/pitest/pit-reports</reportsDirectory>

          <historyInputFile>${project.basedir}/pitest/yauaa_pitest_history.bin</historyInputFile>
          <historyOutputFile>${project.basedir}/pitest/yauaa_pitest_history.bin</historyOutputFile>

          <timestampedReports>true</timestampedReports>

          <excludedMethods>
            <excludedMethod>toString</excludedMethod>
          </excludedMethods>

          <excludedClasses>
            <excludedClass>nl.basjes.parse.useragent.Version</excludedClass>
            <excludedGroup>nl.basjes.parse.useragent.parser.*</excludedGroup> <!-- Generated antlr4 code -->
            <excludedGroup>nl.basjes.parse.useragent.debug.*</excludedGroup>
          </excludedClasses>

          <avoidCallsTo>
            <avoidCallsTo>java.util.logging</avoidCallsTo>
            <avoidCallsTo>org.apache.log4j</avoidCallsTo>
            <avoidCallsTo>org.slf4j</avoidCallsTo>
            <avoidCallsTo>org.apache.commons.logging</avoidCallsTo>
          </avoidCallsTo>
{'fraction_non_alphanumeric': 0.1368176281696379, 'fraction_numerical': 0.004584209943527848, 'mean_word_length': 1.9394610076812915, 'pattern_counts': {'":': 0, '<': 1551, '<?xml version=': 2, '>': 1551, 'https://': 6, 'lorem ipsum': 0, 'www.': 4, 'xml': 20}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3168190', 'n_tokens_mistral': 13548, 'n_tokens_neox': 12418, 'n_words': 1660}