<?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.myfaces.tobago</groupId>
    <artifactId>tobago</artifactId>
    <version>6.0.0</version>
  </parent>
  <packaging>pom</packaging>
  <name>Tobago Examples</name>
  <artifactId>tobago-example</artifactId>

  <properties>
    <app.packaging>war</app.packaging>
    <quarkus.version>2.4.0.Final</quarkus.version>
  </properties>

  <modules>
    <module>tobago-example-blank</module>
    <module>tobago-example-demo</module>
    <module>tobago-example-assembly</module>
    <!-- Spring Boot 3 demo deactivated because it requires Java 17. -->
<!--    <module>tobago-example-spring-boot</module>-->
  </modules>

  <build>
    <!-- For the examples mvn jetty:run should work.
         For Debugging with jetty set following options
            MAVEN_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"
     -->
    <plugins>
      <plugin>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <configuration>
          <!-- use this to change the context path: -->
          <!--
                      <webApp>
                        <contextPath>/example</contextPath>
                      </webApp>
          -->
          <!-- use this to change the port: -->
          <!--
                      <httpConnector>
                        <port>7080</port>
                      </httpConnector>
          -->
        </configuration>
      </plugin>
    </plugins>

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.eclipse.jetty</groupId>
          <artifactId>jetty-maven-plugin</artifactId>
          <version>${jetty.version}</version>
          <configuration>
            <!--
            to run the webapp in jetty in development mode use
            mvn clean jetty:run -Pdev -Pjetty
             -->
            <scanIntervalSeconds>5</scanIntervalSeconds>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.jboss.weld.servlet</groupId>
        <artifactId>weld-servlet-shaded</artifactId>
        <version>5.1.2.Final</version>
      </dependency>
      <dependency>
        <!-- Jakarta Bean Validation 3.0 implementation -->
        <groupId>org.hibernate.validator</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>7.0.5.Final</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>org.apache.myfaces.tobago</groupId>
      <artifactId>tobago-theme-charlotteville</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.myfaces.tobago</groupId>
      <artifactId>tobago-theme-roxborough</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.myfaces.tobago</groupId>
      <artifactId>tobago-theme-scarborough</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.myfaces.tobago</groupId>
      <artifactId>tobago-theme-speyside</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.myfaces.tobago</groupId>
      <artifactId>tobago-theme-standard</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.myfaces.tobago</groupId>
      <artifactId>tobago-core</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>jakarta.enterprise</groupId>
      <artifactId>jakarta.enterprise.cdi-api</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-core</artifactId>
      <scope>compile</scope>
    </dependency>
  </dependencies>

  <profiles>

    <profile>
      <id>dev</id>
      <dependencies>
        <dependency>
          <groupId>org.apache.myfaces.tobago</groupId>
          <artifactId>tobago-config-dev</artifactId>
          <version>${project.version}</version>
        </dependency>
      </dependencies>
    </profile>

    <profile>
      <id>jsf-provided</id>
      <activation>
        <property>
          <name>jsf</name>
          <value>provided</value>
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>org.apache.myfaces.core</groupId>
          <artifactId>myfaces-api</artifactId>
          <version>${myfaces40.version}</version>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.myfaces.core</groupId>
          <artifactId>myfaces-impl</artifactId>
          <version>${myfaces40.version}</version>
          <scope>provided</scope>
        </dependency>
      </dependencies>
    </profile>

    <profile>
      <id>myfaces-4.0</id>
      <activation>
        <property>
          <name>!jsf</name>
          <!--          <name>jsf</name>-->
          <!--          <value>myfaces-4.0</value>-->
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>org.apache.myfaces.core</groupId>
          <artifactId>myfaces-api</artifactId>
          <version>${myfaces40.version}</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.myfaces.core</groupId>
          <artifactId>myfaces-impl</artifactId>
          <version>${myfaces40.version}</version>
          <scope>runtime</scope>
        </dependency>
      </dependencies>
    </profile>

    <profile>
      <id>mojarra-4.0</id>
      <activation>
        <property>
          <name>jsf</name>
          <value>mojarra-4.0</value>
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>org.apache.myfaces.tobago</groupId>
          <artifactId>tobago-config-mojarra</artifactId>
          <version>${project.version}</version>
        </dependency>
        <dependency>
          <groupId>org.glassfish</groupId>
          <artifactId>jakarta.faces</artifactId>
        </dependency>
      </dependencies>
    </profile>

    <profile>
      <!-- only use for jetty with MyFaces, do not use with Mojarra -->
      <id>jetty</id>
      <dependencies>
        <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>jcl-over-slf4j</artifactId>
        </dependency>
        <dependency>
          <groupId>jakarta.inject</groupId>
          <artifactId>jakarta.inject-api</artifactId>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>jakarta.enterprise</groupId>
          <artifactId>jakarta.enterprise.cdi-api</artifactId>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>org.jboss.weld.servlet</groupId>
          <artifactId>weld-servlet-shaded</artifactId>
          <scope>runtime</scope>
        </dependency>
        <dependency>
          <groupId>org.hibernate.validator</groupId>
          <artifactId>hibernate-validator</artifactId>
          <scope>compile</scope>
        </dependency>
      </dependencies>
    </profile>

    <profile>
      <id>tomcat</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <!--
            usage: to build a war for separate deployment
            mvn clean package -Ptomcat

            usage: to run on localhost 8080, change port see below (ONLY JAVA 11)
            mvn clean package -Ptomcat cargo:run
            Browse to the local URL http://localhost:8080/tobago-example-demo/
            -->
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven3-plugin</artifactId>
            <version>1.10.10</version>
            <configuration>
              <container>
                <containerId>tomcat10x</containerId>
                <type>embedded</type>
              </container>
              <deployables>
                <deployable>
                  <groupId>org.apache.myfaces.tobago</groupId>
                  <artifactId>tobago-example-demo</artifactId>
                  <type>war</type>
                  <properties>
                    <context>/</context>
                  </properties>
                </deployable>
              </deployables>
            </configuration>
          </plugin>
        </plugins>
      </build>
      <dependencies>
        <dependency>
          <groupId>org.apache.myfaces.core</groupId>
          <artifactId>myfaces-api</artifactId>
          <version>${myfaces40.version}</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.myfaces.core</groupId>
          <artifactId>myfaces-impl</artifactId>
          <version>${myfaces40.version}</version>
          <scope>runtime</scope>
        </dependency>
        <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>jcl-over-slf4j</artifactId>
        </dependency>
        <dependency>
          <groupId>jakarta.inject</groupId>
          <artifactId>jakarta.inject-api</artifactId>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>jakarta.enterprise</groupId>
          <artifactId>jakarta.enterprise.cdi-api</artifactId>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>jakarta.servlet.jsp.jstl</groupId>
          <artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
          <scope>runtime</scope>
        </dependency>
        <dependency>
          <groupId>org.jboss.weld.servlet</groupId>
          <artifactId>weld-servlet-shaded</artifactId>
          <scope>runtime</scope>
        </dependency>
        <dependency>
          <groupId>org.hibernate.validator</groupId>
          <artifactId>hibernate-validator</artifactId>
          <scope>compile</scope>
        </dependency>
        <!-- this enables the development mode -->
        <dependency>
          <groupId>org.apache.myfaces.tobago</groupId>
          <artifactId>tobago-config-dev</artifactId>
          <version>${project.version}</version>
        </dependency>
      </dependencies>
    </profile>

    <profile>
      <id>tomee</id>
      <dependencies>
        <dependency>
          <groupId>org.apache.myfaces.core</groupId>
          <artifactId>myfaces-api</artifactId>
          <version>${myfaces40.version}</version>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.myfaces.core</groupId>
          <artifactId>myfaces-impl</artifactId>
          <version>${myfaces40.version}</version>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>jcl-over-slf4j</artifactId>
        </dependency>
        <!-- this enables the development mode -->
        <dependency>
          <groupId>org.apache.myfaces.tobago</groupId>
          <artifactId>tobago-config-dev</artifactId>
          <version>${project.version}</version>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <!-- usage: to build a war for separate deployment
                 mvn clean package -Ptomee
                 -->
            <!-- usage: to run on localhost 8080, change port see below
                 mvn clean package tomee:run -Ptomee
                 -->
            <!-- usage: to build an excutable jar
                 mvn clean package tomee:exec -Ptomee
                 -->
            <groupId>org.apache.tomee.maven</groupId>
            <artifactId>tomee-maven-plugin</artifactId>
            <version>9.0.0</version>
            <configuration>
              <tomeeClassifier>plus</tomeeClassifier>
              <!--<tomeeHttpPort>9090</tomeeHttpPort>-->
              <context>ROOT</context>
              <!--<context>/demo</context>-->
              <config>${project.basedir}/src/test/tomee/conf</config>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>liberty</id>
      <build>
        <plugins>
          <plugin>
            <groupId>io.openliberty.tools</groupId>
            <artifactId>liberty-maven-plugin</artifactId>
            <version>3.9</version>
            <configuration>
              <serverXmlFile>${project.basedir}/src/test/liberty/config/server.xml</serverXmlFile>
            </configuration>
          </plugin>
        </plugins>
      </build>
      <dependencies>
        <dependency>
          <groupId>org.apache.myfaces.core</groupId>
          <artifactId>myfaces-api</artifactId>
          <version>${myfaces40.version}</version>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.myfaces.core</groupId>
          <artifactId>myfaces-impl</artifactId>
          <version>${myfaces40.version}</version>
          <scope>provided</scope>
        </dependency>
        <!-- this enables the development mode -->
        <dependency>
          <groupId>org.apache.myfaces.tobago</groupId>
          <artifactId>tobago-config-dev</artifactId>
          <version>${project.version}</version>
        </dependency>
      </dependencies>
    </profile>
    <!--
    todo: profile for meecrowave?
    todo: profile for wildfly?
    todo: profile for websphere?
    todo: profile for weblogic?
    todo: profile for ...?
    -->

  </profiles>

</project>
