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

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

  <modules>
    <module>tobago-example-blank</module>
    <module>tobago-example-demo</module>
    <module>tobago-example-assembly</module>
    <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>
          <!-- for jetty 10 please activate the profile jee8 -->
          <configuration>
            <!--
            to run the webapp in jetty in development mode use
            mvn clean jetty:run -Pdev -Pjetty
             -->
            <scanIntervalSeconds>5</scanIntervalSeconds>
          </configuration>
          <dependencies>
            <dependency> <!-- add JAXB to run the demo with Java 11 and higher -->
              <groupId>javax.xml.bind</groupId>
              <artifactId>jaxb-api</artifactId>
              <version>2.3.1</version>
            </dependency>
          </dependencies>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <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>jee8</id>
      <properties>
        <!-- jetty 10 requires jdk 11 -->
        <jetty.version>10.0.5</jetty.version>
      </properties>
    </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>${myfaces23.version}</version>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.myfaces.core</groupId>
          <artifactId>myfaces-impl</artifactId>
          <version>${myfaces23.version}</version>
          <scope>provided</scope>
        </dependency>
      </dependencies>
    </profile>

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

    <profile>
      <id>mojarra-2.3</id>
      <activation>
        <property>
          <name>jsf</name>
          <value>mojarra-2.3</value>
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>org.apache.myfaces.tobago</groupId>
          <artifactId>tobago-config-mojarra</artifactId>
          <version>${project.version}</version>
        </dependency>
        <!-- from https://eclipse-ee4j.github.io/mojarra/ [BEGIN] -->
        <dependency>
          <groupId>org.glassfish</groupId>
          <artifactId>jakarta.faces</artifactId>
        </dependency>
        <!-- todo: check use of "weld-servlet-core", because "weld-servlet-shaded"
        has double dependencies with this project.-->
        <dependency>
          <groupId>org.jboss.weld.servlet</groupId>
          <artifactId>weld-servlet-shaded</artifactId>
          <version>3.1.9.Final</version>
        </dependency>
        <dependency>
          <groupId>jakarta.annotation</groupId>
          <artifactId>jakarta.annotation-api</artifactId>
          <scope>provided</scope>
          <!-- provided, because it's included in weld-servlet-shaded -->
        </dependency>
        <dependency>
          <groupId>jakarta.servlet.jsp.jstl</groupId>
          <artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
          <version>1.2.7</version>
        </dependency>
        <dependency> <!-- Optional, only when <f:websocket> is used. -->
          <groupId>org.glassfish</groupId>
          <artifactId>jakarta.json</artifactId>
          <version>1.1.6</version>
        </dependency>
        <dependency> <!-- Optional, only when <f:validateBean> or <f:validateWholeBean> is used. -->
          <groupId>org.hibernate.validator</groupId>
          <artifactId>hibernate-validator</artifactId>
          <version>6.2.5.Final</version>
        </dependency>
        <!-- [END] -->
      </dependencies>
    </profile>

    <profile>
      <id>quarkus</id>
      <properties>
        <app.packaging>jar</app.packaging>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-maven-plugin</artifactId>
            <version>${quarkus.version}</version>
            <executions>
              <execution>
                <goals>
                  <goal>build</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <source>${maven.compile.source}</source>
              <target>${maven.compile.target}</target>
            </configuration>
          </plugin>
          <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <executions>
              <execution>
                <id>copy-web-pages</id>
                <phase>compile</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration>
                  <outputDirectory>${project.build.outputDirectory}/META-INF/resources</outputDirectory>
                  <resources>
                    <resource>
                      <directory>src/main/webapp</directory>
                      <excludes>
                        <exclude>WEB-INF/**</exclude>
                      </excludes>
                    </resource>
                  </resources>
                </configuration>
              </execution>
              <execution>
                <id>copy-web-configuration</id>
                <phase>compile</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration>
                  <outputDirectory>${project.build.outputDirectory}/META-INF</outputDirectory>
                  <resources>
                    <resource>
                      <directory>src/main/webapp/WEB-INF</directory>
                    </resource>
                  </resources>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
      <dependencyManagement>
        <dependencies>
          <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-bom</artifactId>
            <version>${quarkus.version}</version>
            <type>pom</type>
            <scope>import</scope>
          </dependency>
        </dependencies>
      </dependencyManagement>
      <dependencies>
        <dependency>
          <groupId>org.apache.myfaces.core</groupId>
          <artifactId>myfaces-api</artifactId>
          <version>${myfaces23x.version}</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.myfaces.core</groupId>
          <artifactId>myfaces-impl</artifactId>
          <version>${myfaces23x.version}</version>
          <scope>runtime</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.myfaces.core.extensions.quarkus</groupId>
          <artifactId>myfaces-quarkus</artifactId>
          <version>${myfaces23x.version}</version>
        </dependency>
        <!-- this enables the development mode -->
        <dependency>
          <groupId>org.apache.myfaces.tobago</groupId>
          <artifactId>tobago-config-dev</artifactId>
          <version>${project.version}</version>
        </dependency>
        <dependency>
          <groupId>ch.qos.logback</groupId>
          <artifactId>logback-classic</artifactId>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>ch.qos.logback</groupId>
          <artifactId>logback-core</artifactId>
          <scope>provided</scope>
        </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>org.apache.openwebbeans</groupId>
          <artifactId>openwebbeans-jsf</artifactId>
          <version>${openwebbeans.version}</version>
          <scope>runtime</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.openwebbeans</groupId>
          <artifactId>openwebbeans-web</artifactId>
          <version>${openwebbeans.version}</version>
          <scope>runtime</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.openwebbeans</groupId>
          <artifactId>openwebbeans-resource</artifactId>
          <version>${openwebbeans.version}</version>
          <scope>runtime</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.myfaces.tobago</groupId>
          <artifactId>tobago-config-owb</artifactId>
          <version>${project.version}</version>
          <scope>runtime</scope>
        </dependency>
        <dependency>
          <groupId>jakarta.inject</groupId>
          <artifactId>jakarta.inject-api</artifactId>
          <version>1.0.5</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>jakarta.enterprise</groupId>
          <artifactId>jakarta.enterprise.cdi-api</artifactId>
          <scope>compile</scope>
        </dependency>
      </dependencies>
    </profile>

    <profile>
      <id>tomcat</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <dependencies>
        <dependency>
          <groupId>org.apache.myfaces.core</groupId>
          <artifactId>myfaces-api</artifactId>
          <version>${myfaces23.version}</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.myfaces.core</groupId>
          <artifactId>myfaces-impl</artifactId>
          <version>${myfaces23.version}</version>
          <scope>runtime</scope>
        </dependency>
        <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>jcl-over-slf4j</artifactId>
        </dependency>
        <dependency>
          <groupId>org.apache.openwebbeans</groupId>
          <artifactId>openwebbeans-jsf</artifactId>
          <version>${openwebbeans.version}</version>
          <scope>runtime</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.openwebbeans</groupId>
          <artifactId>openwebbeans-web</artifactId>
          <version>${openwebbeans.version}</version>
          <scope>runtime</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.openwebbeans</groupId>
          <artifactId>openwebbeans-resource</artifactId>
          <version>${openwebbeans.version}</version>
          <scope>runtime</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.myfaces.tobago</groupId>
          <artifactId>tobago-config-owb</artifactId>
          <version>${project.version}</version>
          <scope>runtime</scope>
        </dependency>
        <dependency>
          <groupId>jakarta.inject</groupId>
          <artifactId>jakarta.inject-api</artifactId>
          <version>1.0.5</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>jakarta.enterprise</groupId>
          <artifactId>jakarta.enterprise.cdi-api</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>
        <dependency> <!-- add JAXB to run the demo with Java 11 and higher -->
          <groupId>javax.xml.bind</groupId>
          <artifactId>jaxb-api</artifactId>
          <version>2.3.1</version>
        </dependency>
      </dependencies>
    </profile>

    <profile>
      <id>tomee</id>
      <dependencies>
        <dependency>
          <groupId>org.apache.myfaces.core</groupId>
          <artifactId>myfaces-api</artifactId>
          <version>${myfaces23.version}</version>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.myfaces.core</groupId>
          <artifactId>myfaces-impl</artifactId>
          <version>${myfaces23.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>8.0.12</version>
            <configuration>
              <tomeeVersion>8.0.12</tomeeVersion>
              <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>

    <!--
    todo: profile for meecromave?
    todo: profile for wildfly?
    todo: profile for websphere?
    todo: profile for weblogic?
    todo: profile for ...?
    -->

  </profiles>

</project>
