<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.developmentontheedge.be5</groupId>
  <artifactId>be5-app</artifactId>
  <version>1.0.2</version>
  <packaging>pom</packaging>

  <name>be5 app parent</name>
  <description>be5 app parent</description>
  <url>https://github.com/DevelopmentOnTheEdge/be5</url>

    <licenses>
        <license>
            <name>MIT License</name>
            <url>http://www.opensource.org/licenses/mit-license.php</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <organization>Development On The Edge</organization>
            <organizationUrl>https://github.com/DevelopmentOnTheEdge</organizationUrl>
        </developer>
    </developers>

  <scm>
      <connection>scm:git:git://github.com/DevelopmentOnTheEdge/be5.git</connection>
      <developerConnection>scm:git:ssh://github.com/DevelopmentOnTheEdge/be5.git</developerConnection>
      <url>https://github.com/DevelopmentOnTheEdge/be5</url>
  </scm>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <build.plugins.plugin.version>3.1</build.plugins.plugin.version>
    <deployServerName>tomcat7</deployServerName>
    <deployServerUrl>http://localhost:8080/manager/text</deployServerUrl>
    <deployPath>app</deployPath>
    <packaging.type>jar</packaging.type>
    <logging.file>logback-console.xml</logging.file>
  </properties>

  <profiles>
    <profile>
      <id>war</id>
      <properties>
        <packaging.type>war</packaging.type>
      </properties>
      <build>
        <finalName>${project.artifactId}</finalName>
        <plugins>
          <plugin>
            <groupId>com.coderplus.maven.plugins</groupId>
            <artifactId>copy-rename-maven-plugin</artifactId>
            <version>1.0.1</version>
            <executions>
              <execution>
                <id>replace-log-file</id>
                <phase>compile</phase>
                <goals>
                  <goal>rename</goal>
                </goals>
                <configuration>
                  <sourceFile>${project.build.outputDirectory}/logback-tomcat.xml</sourceFile>
                  <destinationFile>${project.build.outputDirectory}/logback.xml</destinationFile>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <dependencies>
    <dependency>
      <groupId>com.developmentontheedge.be5.modules</groupId>
      <artifactId>be5-modules-core</artifactId>
      <version>[0.4.0,)</version>
    </dependency>
    <dependency>
      <groupId>com.developmentontheedge.be5</groupId>
      <artifactId>be5-jetty</artifactId>
      <version>[1.0.0,)</version>
    </dependency>
    <dependency>
      <groupId>com.developmentontheedge.be5</groupId>
      <artifactId>be5-test</artifactId>
      <version>[0.4.0,)</version>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <build>
    <resources>
      <resource>
        <directory>${basedir}/src/main/resources</directory>
      </resource>
      <resource>
        <directory>${basedir}</directory>
        <excludes>
          <exclude>.*</exclude>
          <exclude>src/html/**/*.*</exclude>
          <exclude>.idea/**/*</exclude>
          <exclude>*.iml</exclude>
          <exclude>src/frontend/**/*</exclude>
          <exclude>node_modules/**/*</exclude>
          <exclude>dist/**/*</exclude>
          <exclude>src/main/java/**/*.*</exclude>
          <exclude>src/main/resources/**/*.*</exclude>
          <exclude>src/main/webapp/**/*.*</exclude>
          <exclude>target/**/*.*</exclude>
          <exclude>*.properties</exclude>
          <exclude>webpack.*</exclude>
          <exclude>package.json</exclude>
        </excludes>
      </resource>
    </resources>

    <plugins>

       <plugin>
          <groupId>org.sonatype.central</groupId>
          <artifactId>central-publishing-maven-plugin</artifactId>
          <version>0.5.0</version>
          <extensions>true</extensions>
          <configuration>
            <publishingServerId>central</publishingServerId>
            <autoPublish>true</autoPublish>
          </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.6</version>
            <executions>
                <execution>
                    <id>sign-artifacts</id>
                    <phase>verify</phase>
                    <goals>
                        <goal>sign</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

      <plugin>
        <groupId>org.apache.tomcat.maven</groupId>
        <artifactId>tomcat7-maven-plugin</artifactId>
        <version>2.2</version>
        <configuration>
          <url>${deployServerUrl}</url>
          <server>${deployServerName}</server>
          <path>${deployPath}</path>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.developmentontheedge.be5</groupId>
        <artifactId>be5-maven-plugin</artifactId>
        <version>0.1.3</version>
        <configuration>
          <projectPath>./</projectPath>
        </configuration>
        <executions>
          <execution>
            <id>generate-context</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>generate-context</goal>
            </goals>
            <configuration>
              <generateContextPath>${project.build.directory}/${project.artifactId}/META-INF</generateContextPath>
            </configuration>
          </execution>
        </executions>
        <!-- duplicate for (ModuleLoader2.class).getClassLoader().getResources(PROJECT_FILE_NAME); -->
        <dependencies>
          <dependency>
            <groupId>com.developmentontheedge.be5.modules</groupId>
            <artifactId>be5-modules-core</artifactId>
            <version>[0.4.0,)</version>
          </dependency>
          <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>2.2.224</version>
          </dependency>
          <!--dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>42.0.0</version>
          </dependency-->
        </dependencies>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>3.0.0</version>
        <configuration>
          <outputDirectory>distrib</outputDirectory>
          <overWriteReleases>false</overWriteReleases>
          <overWriteSnapshots>false</overWriteSnapshots>
          <overWriteIfNewer>true</overWriteIfNewer>
          <!-- includeScope>runtime</includeScope> <useSubDirectoryPerScope>true</useSubDirectoryPerScope -->
        </configuration>
        <executions>
          <!--execution> <id>copy-dependencies</id> <phase>package</phase> <goals>
           <goal>copy-dependencies</goal> </goals> <configuration> <outputDirectory>distrib</outputDirectory>
           <overWriteReleases>false</overWriteReleases> <overWriteSnapshots>false</overWriteSnapshots>
           <overWriteIfNewer>true</overWriteIfNewer> </configuration> </execution -->
        </executions>
      </plugin>

      <plugin>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <!--version>9.4.3.v20170317</version-->
        <!--version>9.4.48.v20220622</version-->
        <version>9.4.53.v20231009</version>

        <configuration>
          <supportedPackagings>
             <supportedPackaging>jar</supportedPackaging>
          </supportedPackagings>
          <scanIntervalSeconds>0</scanIntervalSeconds>
          <webAppConfig implementation="org.eclipse.jetty.webapp.WebAppContext">
            <sessionHandler implementation="org.eclipse.jetty.server.session.SessionHandler">
              <sessionManager implementation="org.eclipse.jetty.server.session.HashSessionManager">
                <storeDirectory>${basedir}/target/sessions</storeDirectory>
                <idleSavePeriod>1</idleSavePeriod>
              </sessionManager>
            </sessionHandler>
          </webAppConfig>
          <webApp>
            <webInfIncludeJarPattern>^$</webInfIncludeJarPattern>
            <containerIncludeJarPattern>^$</containerIncludeJarPattern>
            <_initParams>
              <org.eclipse.jetty.servlet.Default.useFileMappedBuffer>false</org.eclipse.jetty.servlet.Default.useFileMappedBuffer>
            </_initParams>
          </webApp>
          <systemProperties>
            <systemProperty>
              <name>org.eclipse.jetty.server.Request.maxFormContentSize</name>
              <value>100000000</value>
            </systemProperty>
          </systemProperties>
          <stopKey>stop</stopKey>
          <stopPort>8201</stopPort>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${build.plugins.plugin.version}</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.gmavenplus</groupId>
        <artifactId>gmavenplus-plugin</artifactId>
        <version>1.6</version>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
              <goal>addTestSources</goal>
              <goal>compileTests</goal>
              <goal>removeTestStubs</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <sources>
            <source>
              <directory>${project.basedir}/src/groovy/queries</directory>
              <includes>
                <include>**/*.groovy</include>
              </includes>
            </source>
            <source>
              <directory>${project.basedir}/src/groovy/operations</directory>
              <includes>
                <include>**/*.groovy</include>
              </includes>
            </source>
            <source>
              <directory>${project.basedir}/src/groovy/extenders</directory>
              <includes>
                <include>**/*.groovy</include>
              </includes>
            </source>
            <source>
              <directory>${project.basedir}/src/main/groovy</directory>
              <includes>
                <include>**/*.groovy</include>
              </includes>
            </source>
          </sources>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>3.0.0</version>
        <executions>
          <execution>
            <id>add-test-source</id>
            <phase>process-resources</phase>
            <goals>
              <goal>add-test-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>src/test/groovy</source>
              </sources>
            </configuration>
          </execution>
          <execution>
            <id>add-source</id>
            <phase>process-resources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>src/groovy/queries</source>
                <source>src/groovy/operations</source>
                <source>src/groovy/extenders</source>
                <source>src/main/groovy</source>
              </sources>
            </configuration>
          </execution>
          <execution>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${project.build.directory}/generated-sources/java/</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!--plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>3.0.0</version>
        <executions>
          <execution>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${project.build.directory}/generated-sources/java/</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin-->
       <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
       </plugin>

    </plugins>

  </build>
</project>
