<?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>
  <artifactId>tobago-core</artifactId>
  <packaging>jar</packaging>
  <name>Tobago Core</name>
  <description>Tobago-core contains the basic application components without any special rendering or layout options. The rendering itself depends on the theme.</description>

  <properties>
    <frontend.skip>true</frontend.skip>
  </properties>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>${maven.compile.source}</source>
          <target>${maven.compile.target}</target>
          <encoding>${maven.compile.encoding}</encoding>
          <showWarnings>true</showWarnings>
          <!-- <compilerArgument>-Xlint:all,-serial,-fallthrough</compilerArgument>-->
          <generatedSourcesDirectory>${project.build.directory}/generated</generatedSourcesDirectory>
          <annotationProcessors>
            <annotationProcessor>org.apache.myfaces.tobago.apt.processor.ClassesGenerator</annotationProcessor>
            <annotationProcessor>org.apache.myfaces.tobago.apt.processor.TaglibGenerator</annotationProcessor>
            <annotationProcessor>org.apache.myfaces.tobago.apt.processor.FacesConfigGenerator</annotationProcessor>
            <annotationProcessor>org.apache.myfaces.tobago.apt.processor.CheckstyleConfigGenerator</annotationProcessor>
          </annotationProcessors>
          <compilerArgs>
            <arg>-AsourceFacesConfig=${basedir}/src/main/faces-config/faces-config.xml</arg>
            <arg>-AtargetFacesConfig=META-INF/faces-config.xml</arg>
            <arg>-AtargetTaglib=META-INF</arg>
            <arg>-AtargetCheckstyle=META-INF</arg>
          </compilerArgs>
        </configuration>
        <executions>
          <execution>
            <id>generate-sources</id>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-resources</id>
            <goals><goal>copy-resources</goal></goals>
            <phase>process-classes</phase>
            <configuration>
              <outputDirectory>${project.build.outputDirectory}</outputDirectory>
              <resources>
                <resource>
                  <directory>${project.build.directory}/generated</directory>
                  <includes>
                    <include>META-INF/**/*</include>
                  </includes>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <manifest>
              <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
            </manifest>
            <manifestEntries>
              <Revision>${scm.revision}</Revision>
              <Automatic-Module-Name>${project.groupId}</Automatic-Module-Name>
            </manifestEntries>
            <manifestSections>
              <manifestSection>
                <name>${project.artifactId}</name>
                <manifestEntries>
                  <Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
                  <Implementation-Version>${project.version}</Implementation-Version>
                </manifestEntries>
              </manifestSection>
            </manifestSections>
          </archive>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-source</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <reporting>
    <plugins>

      <plugin>
        <groupId>com.github.matinh.vdldoc</groupId>
        <artifactId>vdldoc-maven-plugin</artifactId>
        <configuration>
          <destDir>tlddoc</destDir>
          <documentTitle>Tag Library Documentation</documentTitle>
          <excludes>
            <exclude>target/classes/**</exclude>
          </excludes>
          <includes>
            <include>target/generated/META-INF/tobago.taglib.xml</include>
          </includes>
          <reportOutputDirectory>target</reportOutputDirectory>
        </configuration>
      </plugin>

    </plugins>
  </reporting>

  <dependencies>
    <dependency>
      <groupId>org.apache.myfaces.core</groupId>
      <artifactId>myfaces-api</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>commons-beanutils</groupId>
      <artifactId>commons-beanutils</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.myfaces.tobago</groupId>
      <artifactId>tobago-tool-apt</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.myfaces.tobago</groupId>
      <artifactId>tobago-tool-annotation</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.jsoup</groupId>
      <artifactId>jsoup</artifactId>
    </dependency>
    <dependency>
      <groupId>jakarta.annotation</groupId>
      <artifactId>jakarta.annotation-api</artifactId>
    </dependency>
    <dependency>
      <groupId>jakarta.enterprise</groupId>
      <artifactId>jakarta.enterprise.cdi-api</artifactId>
    </dependency>
    <dependency>
      <groupId>jakarta.inject</groupId>
      <artifactId>jakarta.inject-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.glassfish</groupId>
      <artifactId>jakarta.el</artifactId>
      <version>4.0.2</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <profiles>
    <profile>
      <id>generate-assembly</id>
      <build>
        <plugins>
          <plugin>
            <groupId>com.github.matinh.vdldoc</groupId>
            <artifactId>vdldoc-maven-plugin</artifactId>
            <configuration>
              <destDir>tlddoc</destDir>
              <documentTitle>Tag Library Documentation</documentTitle>
              <excludes>
                <exclude>target/classes/**</exclude>
              </excludes>
              <includes>
                <include>target/generated/META-INF/tobago.taglib.xml</include>
              </includes>
              <reportOutputDirectory>target</reportOutputDirectory>
            </configuration>
            <executions>
              <execution>
                <id>attach-tlddoc</id>
                <phase>prepare-package</phase>
                <goals>
                  <goal>vdldoc</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
              <execution>
                <id>tlddoc-jar</id>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <descriptors>
                <descriptor>assembly-tlddoc.xml</descriptor>
              </descriptors>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>attach-source</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-source</id>
                <goals><goal>jar</goal></goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>jsf-4.0</id>
      <activation>
        <property>
          <name>!jsf</name>
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>org.apache.myfaces.core</groupId>
          <artifactId>myfaces-test</artifactId>
        </dependency>
      </dependencies>
    </profile>

  </profiles>
</project>
