<?xml version="1.0"?>
<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">

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

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.scientificcms</groupId>
        <artifactId>scientificcms-bundle-devel</artifactId>
        <relativePath>../scicms-bundle-devel</relativePath>
        <version>7.0.0-SNAPSHOT</version>
    </parent>

    <groupId>org.scientificcms</groupId>
    <artifactId>scicms-bundle-devel-wildfly</artifactId>
    <!--<version>7.0.0-SNAPSHOT</version>-->
    <packaging>war</packaging>

    <name>ScientificCMS Devel Bundle for Wildfly</name>
    <url>http://www.scientificcms.org/modules/web/wildfly</url>

    <dependencies>
        <dependency>
            <groupId>org.libreccm</groupId>
            <artifactId>ccm-wildfly</artifactId>
            <version>7.0.0-SNAPSHOT</version>
        </dependency>
        
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>font-awesome</artifactId>
            <!--<version>4.7.0</version>-->
        </dependency>
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>requirejs</artifactId>
            <!--<version>2.3.5</version>-->
        </dependency>
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>requirejs-domready</artifactId>
            <!--<version>2.0.1-2</version>-->
        </dependency>
        <dependency>
            <groupId>org.webjars.npm</groupId>
            <artifactId>tinymce</artifactId>
            <!--<version>4.8.2</version>-->
        </dependency>
        <!-- <dependency>
            <groupId>org.librecms</groupId>
            <artifactId>ccm-cms-js</artifactId>
            <version>7.0.0-SNAPSHOT</version>
        </dependency> -->
<!--        <dependency>
            <groupId>org.librecms</groupId>
            <artifactId>ccm-cms-tinymce</artifactId>
            <version>${project.parent.version}</version>
        </dependency>-->
    </dependencies>

    <build>
        <finalName>scientificcms-bundle-devel-wildfly-${project.version}</finalName>
        
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <!--<resource>
                <directory>${project.build.directory}/generated-resources</directory>
            </resource>-->
        </resources>
        
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <optimize>true</optimize>
                    <debug>true</debug>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
            </plugin>

            <!-- <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>

                <configuration>
                    <installDirectory>../node</installDirectory>
                </configuration>

                <executions>
                    <execution>
                        <id>Install node.js and NPM</id>
                        <goals>
                            <goal>install-node-and-npm</goal>
                        </goals>
                        <configuration>
                            <nodeVersion>v16.14.2</nodeVersion>
                        </configuration>
                    </execution>
                    <execution>
                        <id>npm install</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <arguments>- -userconfig ../scicms.npmrc install</arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>build</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <arguments>- -userconfig ../scicms.npmrc run build</arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin> -->

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    
                    <webResources>
                        <resource>
                            <directory>src/main/resources</directory>
                        </resource>
                        <!--<resource>
                            <directory>${project.build.directory}/generated-resources</directory>
                        </resource>-->
                    </webResources>

                    <overlays>
                        <overlay>
                            <groupId>org.libreccm</groupId>
                            <artifactId>ccm-editor</artifactId>
                            <type>jar</type>
                        </overlay>
                        <overlay>
                            <groupId>org.libreccm</groupId>
                            <artifactId>ccm-theme-foundry</artifactId>
                            <type>jar</type>
                        </overlay>
                        <overlay>
                            <groupId>org.libreccm</groupId>
                            <artifactId>ccm-core</artifactId>
                            <type>jar</type>
                            <includes>
                                <include>assets/</include>
                            </includes>
                        </overlay>
                        <overlay>
                            <groupId>org.libreccm</groupId>
                            <artifactId>ccm-core</artifactId>
                            <type>jar</type>
                            <includes>
                                <include>themes/</include>
                            </includes>
                        </overlay>
                        <overlay>
                            <groupId>org.libreccm</groupId>
                            <artifactId>ccm-core</artifactId>
                            <type>jar</type>
                            <includes>
                                <include>WEB-INF/</include>
                            </includes>
                        </overlay>
                        <overlay>
                            <groupId>org.libreccm</groupId>
                            <artifactId>ccm-shortcuts</artifactId>
                            <type>jar</type>
                            <includes>
                                <include>WEB-INF/</include>
                            </includes>
                        </overlay>
                        <overlay>
                            <groupId>org.libreccm</groupId>
                            <artifactId>ccm-core</artifactId>
                            <type>jar</type>
                            <includes>
                                <include>resources/</include>
                            </includes>
                        </overlay>
                        <overlay>
                            <groupId>org.librecms</groupId>
                            <artifactId>ccm-cms</artifactId>
                            <type>jar</type>
                            <includes>
                                <include>WEB-INF/</include>
                            </includes>
                        </overlay>
                        <overlay>
                            <groupId>org.librecms</groupId>
                            <artifactId>ccm-cms</artifactId>
                            <type>jar</type>
                            <includes>
                                <include>assets/</include>
                            </includes>
                        </overlay>
                        <overlay>
                            <groupId>org.librecms</groupId>
                            <artifactId>ccm-cms</artifactId>
                            <type>jar</type>
                            <includes>
                                <include>icons/</include>
                            </includes>
                        </overlay> 
                        <overlay>
                            <groupId>org.librecms</groupId>
                            <artifactId>ccm-cms</artifactId>
                            <type>jar</type>
                            <includes>
                                <include>templates/</include>
                            </includes>
                        </overlay>
<!--                        <overlay>
                            <groupId>org.librecms</groupId>
                            <artifactId>ccm-cms-tinymce</artifactId>
                            <type>jar</type>
                            <includes>
                                <include>scripts/</include>
                            </includes>
                        </overlay>-->
                        <overlay>
                            <groupId>org.scientificcms</groupId>
                            <artifactId>sci-types-department</artifactId>
                            <type>jar</type>
                            <includes>
                                <include>assets/</include>
                            </includes>
                        </overlay>
                        <overlay>
                            <groupId>org.scientificcms</groupId>
                            <artifactId>sci-types-department</artifactId>
                            <type>jar</type>
                            <includes>
                                <include>WEB-INF/</include>
                            </includes>
                        </overlay>
                        <overlay>
                            <groupId>org.scientificcms</groupId>
                            <artifactId>sci-types-project</artifactId>
                            <type>jar</type>
                            <includes>
                                <include>assets/</include>
                            </includes>
                        </overlay>
                        <overlay>
                            <groupId>org.scientificcms</groupId>
                            <artifactId>sci-types-project</artifactId>
                            <type>jar</type>
                            <includes>
                                <include>WEB-INF/</include>
                            </includes>
                        </overlay>
                        <overlay>
                            <groupId>org.scientificcms</groupId>
                            <artifactId>sci-publications</artifactId>
                            <type>jar</type>
                            <includes>
                                <include>assets/</include>
                            </includes>
                        </overlay>
                        <overlay>
                            <groupId>org.scientificcms</groupId>
                            <artifactId>sci-publications</artifactId>
                            <type>jar</type>
                            <includes>
                                <include>WEB-INF/</include>
                            </includes>
                        </overlay>
                    </overlays>
                </configuration>
            </plugin>
            
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <configuration>
                    <excludeDefaultDirectories>true</excludeDefaultDirectories>
                    <filesets>
                        <fileset>
                            <directory>${project.build.directory}</directory>
                            <excludes>
                                <exclude>wildfly*/**</exclude>
                            </excludes>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>
            
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>properties-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>read-runtime-properties</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>read-project-properties</goal>
                        </goals>
                        <configuration>
                            <files>
                                <file>${project.basedir}/runtime.example.properties</file>
                                <file>${project.basedir}/runtime.properties</file>
                            </files>
                            <quiet>true</quiet>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.wildfly.plugins</groupId>
                <artifactId>wildfly-maven-plugin</artifactId>
                <configuration>
                    <skip>false</skip>
                    <propertiesFile>${project.basedir}/wildfly.properties</propertiesFile>
                    <java-opts>
                        <java-opt>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8787</java-opt>
                    </java-opts>
                </configuration>
            </plugin>
            
            <plugin>
                <groupId>org.wildfly.plugins</groupId>
                <artifactId>wildfly-jar-maven-plugin</artifactId>
                <configuration>
                    <cliSessions>
                        <cli-session>
                            <script-files>
                                <script>./set-transaction-timeout.cli</script>
                            </script-files>
                        </cli-session>
                    </cliSessions>
                    <jvmArguments>
                        <arg>-agentlib:jdwp=transport=dt_socket,server=y,suspend=${libreccm.debug.suspend},address=${libreccm.debug.port}</arg>
                        <arg>-Xmx16G</arg>
                    </jvmArguments>
                    <arguments>
                        -Dorg.wildfly.datasources.postgresql.database=${libreccm.database.name} 
                        -Dorg.wildfly.datasources.postgresql.host=${libreccm.database.host} 
                        -Dorg.wildfly.datasources.postgresql.jndi-name=java:/comp/env/jdbc/libreccm/db
                        -Dorg.wildfly.datasources.postgresql.password=${libreccm.database.password} 
                        -Dorg.wildfly.datasources.postgresql.port=${libreccm.database.port} 
                        -Dorg.wildfly.datasources.postgresql.user-name=${libreccm.database.user} 
                    </arguments>
                    <feature-packs>
                        <feature-pack>
                            <location>wildfly@maven(org.jboss.universe:community-universe)#24.0.1.Final</location>
                        </feature-pack>
                        <feature-pack>
                            <groupId>org.wildfly</groupId>
                            <artifactId>wildfly-datasources-galleon-pack</artifactId>
                            <version>2.0.2.Final</version>
                        </feature-pack>
                    </feature-packs>
                    <layers>
                        <layer>cdi</layer>
                        <layer>datasources</layer>
                        <layer>ejb</layer>
                        <layer>jaxrs</layer>
                        <layer>jpa</layer>
                        <layer>jsf</layer>
                        <layer>jsonp</layer>
                        <layer>logging</layer>
                        <layer>mail</layer>
                        <layer>management</layer>
                        <layer>postgresql-datasource</layer>
                    </layers>
<!--                    <excluded-layers>
                        <layer>deployment-scanner</layer>
                    </excluded-layers>-->
                    <skip>false</skip>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>package</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        
    </build>
    
    <reporting>
        <excludeDefaults>true</excludeDefaults>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>summary</report>
                            <report>licenses</report>
                            <report>scm</report>
                            <report>dependency-management</report>
                            <report>plugin-management</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
        </plugins>
    </reporting>

</project>


