<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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
 *
 *  http://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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.apache.struts</groupId>
        <artifactId>struts2-apps</artifactId>
        <version>7.2.0-SNAPSHOT</version>
    </parent>

    <artifactId>struts2-showcase</artifactId>
    <packaging>war</packaging>
    <name>Struts 2 Showcase Webapp</name>

    <profiles>
        <profile>
            <id>hostedqa</id>
            <properties>
                <resourceId>12</resourceId>
                <suiteId>9</suiteId>
                <clientConfigs>8</clientConfigs>
                <appConfigs>7</appConfigs>
            </properties>
        </profile>
    </profiles>
    <dependencies>
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-config-browser-plugin</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-tiles-plugin</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-json-plugin</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-convention-plugin</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-spring-plugin</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-bean-validation-plugin</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-async-plugin</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-velocity-plugin</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-velocity-tools-view-jakarta</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-velocity-tools-jsp-jakarta</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-xslt-plugin</artifactId>
        </dependency>

        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Logging -->
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-jcl</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j-impl</artifactId>
        </dependency>

        <dependency>
           <groupId>org.sitemesh</groupId>
           <artifactId>sitemesh</artifactId>
           <version>3.2.2</version>
        </dependency>

       <dependency>
           <groupId>junit</groupId>
           <artifactId>junit</artifactId>
           <scope>test</scope>
       </dependency>

        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>

       <dependency>
           <groupId>org.htmlunit</groupId>
           <artifactId>htmlunit</artifactId>
           <scope>test</scope>
       </dependency>

        <!-- BeanValidation Example -->
        <dependency>
            <groupId>org.hibernate.validator</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>${hibernate-validator.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>jakarta.validation</groupId>
                    <artifactId>jakarta.validation-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!--
         Nashorn (the built-in JDK javascript engine) was deprecated in JDK 11 and removed in JDK 15
         As a result attempting to use @ScriptAssert on JDK 17 leads to the exception
         See more details
         https://stackoverflow.com/questions/78008950/resolve-org-hibernate-validator-spi-scripting-scriptevaluatornotfoundexception
         -->
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-jsr223</artifactId>
            <version>3.0.25</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-dependency-plugin</artifactId>
              <executions>
                <execution>
                  <?m2e ignore?>
                  <id>copy-dependencies</id>
                  <phase>package</phase>
                  <goals>
                    <goal>copy</goal>
                  </goals>
                  <configuration>
                    <outputDirectory>${project.build.directory}/extraclasspath</outputDirectory>
                    <artifactItems>
                      <artifactItem>
                        <groupId>org.apache.struts</groupId>
                        <artifactId>struts2-velocity-tools-view-jakarta</artifactId>
                        <destFileName>struts2-velocity-tools-view-jakarta.jar</destFileName>
                      </artifactItem>
                      <artifactItem>
                        <groupId>org.apache.struts</groupId>
                        <artifactId>struts2-velocity-tools-jsp-jakarta</artifactId>
                        <destFileName>struts2-velocity-tools-jsp-jakarta.jar</destFileName>
                      </artifactItem>
                    </artifactItems>
                    <overWriteReleases>false</overWriteReleases>
                    <overWriteSnapshots>false</overWriteSnapshots>
                    <overWriteIfNewer>true</overWriteIfNewer>
                  </configuration>
                </execution>
              </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>3.5.5</version>
                <configuration>
                    <includes>
                        <include>it.org.apache.struts2.showcase.*Test</include>
                    </includes>
                    <systemPropertyVariables>
                        <http.port>8090</http.port>
                    </systemPropertyVariables>
                </configuration>
                <executions>
                    <execution>
                        <id>integration-test</id>
                        <goals>
                            <goal>integration-test</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>verify</id>
                        <goals>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>11.0.26</version>
                <configuration>
                    <stopKey>CTRL+C</stopKey>
                    <stopPort>8999</stopPort>
                    <systemProperties>
                        <systemProperty>
                            <name>slf4j</name>
                            <value>false</value>
                        </systemProperty>
                    </systemProperties>
                    <httpConnector>
                        <port>8090</port>
                    </httpConnector>
                    <scan>10</scan>
                    <webApp>
                      <extraClasspath>
                        ${project.build.directory}/extraclasspath/struts2-velocity-tools-view-jakarta.jar,
                        ${project.build.directory}/extraclasspath/struts2-velocity-tools-jsp-jakarta
                      </extraClasspath>
                      <contextPath>/struts2-showcase</contextPath>
                      <descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
                    </webApp>
                </configuration>
                <executions>
                    <execution>
                        <id>start-jetty</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <!-- stop any previous instance to free up the port -->
                            <goal>stop</goal>
                            <goal>start</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>stop-jetty</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
             </plugin>

            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <argLine>@{argLine}</argLine>
                    <excludes>
                        <exclude>it/**</exclude>
                        <exclude>**/*$*</exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>

        <resources>
            <!-- Include resources under src/main/java in WEB-INF/classes -->
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.java</include>
                </includes>
            </resource>
        </resources>

    </build>
    <properties>
    	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
</project>
