<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">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.htmlunit</groupId>
    <artifactId>htmlunit-cssparser</artifactId>
    <version>4.21.0</version>
    <name>HtmlUnit CSS Parser</name>
    <organization>
        <name>HtmlUnit</name>
        <url>https://www.htmlunit.org</url>
    </organization>
    <packaging>jar</packaging>
    <description>CSS parser for HtmlUnit.</description>
    <url>https://github.com/HtmlUnit/htmlunit-cssparser</url>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.build.timestamp.format>yyyy-MM-dd HH:mm</maven.build.timestamp.format>

        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>

        <!-- test dependencies -->
        <junit.version>5.14.1</junit.version>
        <junit-launcher.version>1.14.1</junit-launcher.version>
        <commons-io.version>2.21.0</commons-io.version>

        <!-- quality -->
        <checkstyle.version>12.3.0</checkstyle.version>
        <dependencycheck.version>10.0.4</dependencycheck.version>

        <!-- plugins -->
        <central-publishing-plugin.version>0.9.0</central-publishing-plugin.version>
        <checkstyle-plugin.version>3.6.0</checkstyle-plugin.version>
        <gpg-plugin.version>3.2.8</gpg-plugin.version>
        <enforcer-plugin.version>3.6.2</enforcer-plugin.version>
        <compiler-plugin.version>3.14.1</compiler-plugin.version>
        <jar-plugin.version>3.5.0</jar-plugin.version>
        <release-plugin.version>3.3.1</release-plugin.version>
        <source-plugin.version>3.4.0</source-plugin.version>
        <javadoc-plugin.version>3.12.0</javadoc-plugin.version>
        <surefire-plugin.version>3.5.4</surefire-plugin.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>${enforcer-plugin.version}</version>
                <executions>
                    <execution>
                        <id>enforce-maven</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>3.6.3</version>
                                </requireMavenVersion>
                                <requireJavaVersion>
                                    <version>1.8.0</version>
                                </requireJavaVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.sonatype.central</groupId>
                <artifactId>central-publishing-maven-plugin</artifactId>
                <version>${central-publishing-plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <publishingServerId>central</publishingServerId>
                </configuration>
            </plugin>
            <!--
            <plugin>
                <groupId>org.owasp</groupId>
                <artifactId>dependency-check-maven</artifactId>
                <version>${dependencycheck.version}</version>
                <configuration>
                    <failBuildOnCVSS>0</failBuildOnCVSS>
                    <assemblyAnalyzerEnabled>false</assemblyAnalyzerEnabled>
                    <nvdDatafeedUrl>https://mirror.cveb.in/nvd/json/cve/1.1/nvdcve-1.1-{0}.json.gz</nvdDatafeedUrl>
                </configuration>
              <executions>
                  <execution>
                      <goals>
                          <goal>check</goal>
                      </goals>
                  </execution>
              </executions>
            </plugin>
            -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${surefire-plugin.version}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${compiler-plugin.version}</version>
            </plugin>
            <plugin>
                <!-- generate parsers and lexers before compiling -->
                <groupId>com.helger.maven</groupId>
                <artifactId>ph-javacc-maven-plugin</artifactId>
                <version>4.1.5</version>
                <executions>
                    <execution>
                        <id>javacc</id>
                        <goals>
                            <goal>javacc</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.google.code.maven-replacer-plugin</groupId>
                <artifactId>replacer</artifactId>
                <version>1.5.3</version>
                <executions>
                    <execution>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>replace</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <basedir>${project.build.directory}/generated-sources/javacc/org/htmlunit/cssparser/parser/javacc</basedir>
                    <includes>
                        <include>CSS3Parser.java</include>

                        <include>Token.java</include>
                        <include>TokenMgrException.java</include>
                    </includes>
                    <regex>true</regex>
                    <regexFlags>
                        <regexFlag>MULTILINE</regexFlag>
                    </regexFlags>
                    <replacements>
                        <replacement>
                            <token>@SuppressWarnings("unused")</token>
                            <value>@SuppressWarnings({"unused", "all"})</value>
                        </replacement>
                        <replacement>
                            <token>\{if \("" != null\) return (..*)\}\n    throw new Error\("Missing return statement in function"\);</token>
                            <value>return $1</value>
                        </replacement>
                        <replacement>
                            <token>\{if \("" != null\) return (..*)\}\n(\s*break;)?</token>
                            <value>return $1</value>
                        </replacement>
                        <replacement>
                            <token>\{if \("" != null\) return;\}</token>
                            <value>return;</value>
                        </replacement>
                        <replacement>
                            <token>\{if \(true\) throw (..*)\}(\n)(\s*break;\n)?</token>
                            <value>throw $1$2</value>
                        </replacement>
                        <replacement>
                            <token>(^throw toCSSParseException\("invalidExprColon"(..*);\n)(\s*break;\n)?</token>
                            <value>$1</value>
                        </replacement>
                        <replacement>
                            <token>\s*throw new IllegalStateException \("Missing return statement in function"\);</token>
                            <value></value>
                        </replacement>
                        <replacement>
                            <token>;\s*;</token>
                            <value>;</value>
                        </replacement>
                    </replacements>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${checkstyle-plugin.version}</version>
                <configuration>
                    <configLocation>checkstyle.xml</configLocation>
                    <suppressionsLocation>checkstyle_suppressions.xml</suppressionsLocation>
                    <includeTestSourceDirectory>true</includeTestSourceDirectory>
                    <consoleOutput>true</consoleOutput>
                    <failsOnError>true</failsOnError>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>com.puppycrawl.tools</groupId>
                        <artifactId>checkstyle</artifactId>
                        <version>${checkstyle.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>${jar-plugin.version}</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                        <manifestEntries>
                            <Url>${project.url}</Url>
                            <Build-Time>${maven.build.timestamp}</Build-Time>
                        </manifestEntries>
                        <addMavenDescriptor>false</addMavenDescriptor>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>${source-plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${javadoc-plugin.version}</version>
                <configuration>
                    <quiet>true</quiet>
                    <show>protected</show>
                    <doclint>html,reference,syntax</doclint>
                    <detectLinks>true</detectLinks>
                    <detectJavaApiLink>true</detectJavaApiLink>
                    <excludePackageNames>org.htmlunit.cssparser.parser.javacc</excludePackageNames>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>${gpg-plugin.version}</version>
                <executions>
                    <execution>
                        <phase>verify</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.10</version>
                <configuration>
                    <downloadSources>true</downloadSources>
                    <downloadJavadocs>true</downloadJavadocs>
                    <additionalBuildcommands>
                        <buildcommand>net.sf.eclipsecs.core.CheckstyleBuilder</buildcommand>
                    </additionalBuildcommands>
                    <additionalProjectnatures>
                        <projectnature>net.sf.eclipsecs.core.CheckstyleNature</projectnature>
                    </additionalProjectnatures>
                    <additionalConfig>
                        <file>
                            <name>.checkstyle</name>
                            <content>
<![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
    <local-check-config name="CSS Parser" location="checkstyle.xml" type="project" description="CSS Parser">
        <property name="checkstyle.suppressions.file" value="$${project_loc}/checkstyle_suppressions.xml"/>
        <additional-data name="protect-config-file" value="false" />
    </local-check-config>
    <fileset name="all" enabled="true" check-config-name="CSS Parser" local="true">
        <file-match-pattern match-pattern="^src/.*\.java$" include-pattern="true"/>
    </fileset>
    <filter name="NonSrcDirs" enabled="true" />
</fileset-config>
]]>
                            </content>
                        </file>
                    </additionalConfig>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>${release-plugin.version}</version>
            </plugin>
        </plugins>
    </build>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:git@github.com:HtmlUnit/htmlunit-cssparser.git</connection>
        <developerConnection>scm:git:git@github.com:HtmlUnit/htmlunit-cssparser.git</developerConnection>
        <url>https://github.com/htmlunit</url>
    </scm>

    <mailingLists>
    </mailingLists>
    <developers>
        <developer>
            <name>Ronald Brill</name>
            <id>rbri</id>
            <email>rbri@rbri.de</email>
            <url>http://www.wetator.org/</url>
            <timezone>+1</timezone>
        </developer>
    </developers>
    <contributors>
        <contributor>
            <name>David Schweinsberg</name>
        </contributor>
        <contributor>
            <name>Alan Krueger</name>
        </contributor>
        <contributor>
            <name>Daniel Gredler</name>
        </contributor>
        <contributor>
            <name>Johannes Koch</name>
        </contributor>
        <contributor>
            <name>Ahmed Ashour</name>
        </contributor>
        <contributor>
            <name>Christian Morgner</name>
        </contributor>
        <contributor>
            <name>Paul Selormey</name>
        </contributor>
        <contributor>
            <name>Ivan Di Francesco</name>
        </contributor>
    </contributors>

    <dependencies>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-launcher</artifactId>
            <version>${junit-launcher.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>${commons-io.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

</project>
