<?xml version="1.0"?>
<project
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
    xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.jbpm.contrib</groupId>
    <artifactId>workitems</artifactId>
    <version>7.45.0.Final</version>
  </parent>

  <artifactId>repository</artifactId>
  <name>Repository</name>
  <description>Workitems Repository</description>
  <organization>
    <name>jBPM dev team</name>
  </organization>
  <packaging>jar</packaging>

  <build>
    <resources>
      <resource>
        <directory>${project.build.directory}/maven-shared-archive-resources</directory>
        <filtering>true</filtering>
        <includes>
          <include>*.html</include>
        </includes>
      </resource>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-remote-resources-plugin</artifactId>
        <version>1.5</version>
        <configuration>
          <resourceBundles>
            <resourceBundle>${project.groupId}:template-resources:${project.version}</resourceBundle>
          </resourceBundles>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>process</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <!-- root module has no assembly so ignore it -->
          <ignoreMissingDescriptor>true</ignoreMissingDescriptor>
          <descriptors>
            <descriptor>${project.basedir}/assembly/assembly.xml</descriptor>
          </descriptors>
          <archive>
            <addMavenDescriptor>false</addMavenDescriptor>
          </archive>
        </configuration>
        <executions>
          <execution>
            <phase>prepare-package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <appendAssemblyId>false</appendAssemblyId>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.8</version>
        <executions>
          <execution>
            <id>create repos index files</id>
            <phase>prepare-package</phase>
            <configuration>
              <target>
                <concat fixlastline="yes" destfile="${project.build.directory}/${project.artifactId}-${project.version}/index.conf">
                  <fileset dir="${project.build.directory}/${project.artifactId}-${project.version}" includes="**/repoconf.part"/>
                </concat>
                <concat fixlastline="yes" destfile="${project.build.directory}/${project.artifactId}-${project.version}/index.html">
                  <fileset file="${project.build.directory}/classes/repoheader.html"/>
                  <fileset dir="${project.build.directory}/${project.artifactId}-${project.version}" includes="**/repoindex.html"/>
                  <fileset file="${project.build.directory}/classes/repofooter.html"/>
                </concat>
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
          <execution>
            <id>delete repo resources</id>
            <phase>prepare-package</phase>
            <configuration>
              <target>
                <delete>
                  <fileset dir="${project.build.directory}/${project.artifactId}-${project.version}" includes="repo*.html"/>
                </delete>
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
          <execution>
            <id>create wid service info</id>
            <phase>prepare-package</phase>
            <configuration>
              <target>
                <concat fixlastline="yes" destfile="${project.build.directory}/${project.artifactId}-${project.version}/serviceinfo.js">
                  <fileset file="${project.build.directory}/classes/serviceinfoheader.js"/>
                  <fileset dir="${project.build.directory}/${project.artifactId}-${project.version}" includes="**/serviceinfo.json"/>
                  <fileset file="${project.build.directory}/classes/serviceinfofooter.js"/>
                </concat>
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
          <execution>
            <id>create test wid service info</id>
            <phase>prepare-package</phase>
            <configuration>
              <target>
                <concat fixlastline="yes" destfile="${project.build.testOutputDirectory}/serviceinfo.js">
                  <fileset file="${project.build.directory}/classes/serviceinfoheader.js"/>
                  <fileset dir="${project.build.directory}/${project.artifactId}-${project.version}" includes="**/serviceinfo.json"/>
                  <fileset file="${project.build.directory}/classes/serviceinfofooter.js"/>
                </concat>
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
          <execution>
            <id>create jar service info</id>
            <phase>prepare-package</phase>
            <configuration>
              <target>
                <concat fixlastline="yes" destfile="${project.build.directory}/classes/serviceinfo.js">
                  <fileset file="${project.build.directory}/classes/serviceinfoheader.js"/>
                  <fileset dir="${project.build.directory}/${project.artifactId}-${project.version}" includes="**/serviceinfo.json"/>
                  <fileset file="${project.build.directory}/classes/serviceinfofooter.js"/>
                </concat>
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-kafka-workitem-resources</id>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <encoding>UTF-8</encoding>
              <resources>
                <resource>
                  <directory>target/${artifactId}-${version}/kafka-workitem</directory>
                  <includes>
                    <include>*.wid</include>
                    <include>*.bpmn2</include>
                    <include>*.jar</include>
                    <include>*.xml</include>
                    <include>*.png</include>
                  </includes>
                  <filtering>false</filtering>
                </resource>
              </resources>
              <outputDirectory>target/test-classes/kafka-workitem</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <executions>
            <execution>
              <id>ban-duplicated-classes</id>
              <phase>validate</phase>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <rules>
                  <banDuplicateClasses>
                    <ignoreClasses combine.children="append">
                      <ignoreClass>com.google.common.*</ignoreClass>
                      <ignoreClass>com.google.thirdparty.*</ignoreClass>
                      <ignoreClass>javax.xml.*</ignoreClass>
                      <ignoreClass>javax.xml.stream.*</ignoreClass>
                      <ignoreClass>javax.xml.namespace.*</ignoreClass>
                      <ignoreClass>javax.ws.rs.*</ignoreClass>
                      <ignoreClass>org.newsclub.net.*</ignoreClass>
                      <ignoreClass>org.aopalliance.*</ignoreClass>
                      <ignoreClass>javax.inject.*</ignoreClass>
                      <ignoreClass>org.apache.http.*</ignoreClass>
                    </ignoreClasses>
                  </banDuplicateClasses>
                </rules>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <dependencies>
    
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>template-resources</artifactId>
      <scope>provided</scope>
    </dependency>

    <!-- wid processor depends -->
    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-workitems-core</artifactId>
    </dependency>

    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-core</artifactId>
      <scope>provided</scope>
    </dependency>


    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
    </dependency>

    <!-- test dependencies -->
    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-workitems-core</artifactId>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-server</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.eclipse.jetty.orbit</groupId>
          <artifactId>javax.servlet</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-servlet</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-servlets</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-webapp</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-client</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-model</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.powermock</groupId>
      <artifactId>powermock-api-mockito</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.powermock</groupId>
      <artifactId>powermock-module-junit4</artifactId>
      <scope>test</scope>
    </dependency>

  </dependencies>
  
    <profiles>
    <profile>
      <id>all</id>
      <activation>
        <property>
          <name>!productized</name>
        </property>
      </activation>
      <dependencies>
        <!-- module dependencies -->
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>archive-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>dropbox-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>exec-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>ftp-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>google-calendar-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	      <exclusions>
	        <exclusion>
	          <groupId>com.google.oauth-client</groupId>
	          <artifactId>google-oauth-client-jetty</artifactId>
	        </exclusion>
	      </exclusions>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>google-drive-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	      <exclusions>
	        <exclusion>
	          <groupId>com.google.oauth-client</groupId>
	          <artifactId>google-oauth-client-jetty</artifactId>
	        </exclusion>
	      </exclusions>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>google-mail-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	      <exclusions>
	        <exclusion>
	          <groupId>com.google.oauth-client</groupId>
	          <artifactId>google-oauth-client-jetty</artifactId>
	        </exclusion>
	      </exclusions>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>google-sheets-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	      <exclusions>
	        <exclusion>
	          <groupId>com.google.oauth-client</groupId>
	          <artifactId>google-oauth-client-jetty</artifactId>
	        </exclusion>
	      </exclusions>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>google-tasks-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	      <exclusions>
	        <exclusion>
	          <groupId>com.google.oauth-client</groupId>
	          <artifactId>google-oauth-client-jetty</artifactId>
	        </exclusion>
	      </exclusions>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>google-translate-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>ibm-watson-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>ifttt-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>jabber-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>java-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>jpa-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>parser-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>rss-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>transform-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>twitter-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>github-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>jira-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>ethereum-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>camel-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>openweathermap-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>mavenembedder-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>slack-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>pdf-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>execute-sql-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>riot-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>pastebin-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>vimeo-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>kafka-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>google-maps-workitem</artifactId>
	      <exclusions>
	        <exclusion>
	          <groupId>org.mortbay.jetty</groupId>
	          <artifactId>jetty</artifactId>
	        </exclusion>
	      </exclusions>
	      <type>zip</type>
	      <scope>provided</scope>
	    </dependency>
	    <dependency>
	      <groupId>org.jbpm.contrib</groupId>
	      <artifactId>okta-workitem</artifactId>
	      <type>zip</type>
	      <scope>provided</scope>
	    </dependency>
        <dependency>
          <groupId>org.jbpm.contrib</groupId>
          <artifactId>docker-workitem</artifactId>
          <type>zip</type>
          <scope>provided</scope>
        </dependency>
        <!-- jbpm workitems dependencies -->
        <dependency>
          <groupId>org.jbpm</groupId>
          <artifactId>jbpm-workitems-bpmn2</artifactId>
          <type>zip</type>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.jbpm</groupId>
          <artifactId>jbpm-workitems-email</artifactId>
          <type>zip</type>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.jbpm</groupId>
          <artifactId>jbpm-workitems-jms</artifactId>
          <type>zip</type>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.jbpm</groupId>
          <artifactId>jbpm-workitems-rest</artifactId>
          <type>zip</type>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.jbpm</groupId>
          <artifactId>jbpm-workitems-webservice</artifactId>
          <type>zip</type>
          <scope>provided</scope>
        </dependency>
      </dependencies>
    </profile>
    <profile>
      <id>productized</id>
      <activation>
        <property>
          <name>productized</name>
          <value>true</value>
        </property>
      </activation>
      <dependencies>
        <!-- module dependencies -->
        <dependency>
          <groupId>org.jbpm.contrib</groupId>
          <artifactId>camel-workitem</artifactId>
          <type>zip</type>
          <scope>provided</scope>
        </dependency>
        <!-- jbpm workitems dependencies -->
        <dependency>
          <groupId>org.jbpm</groupId>
          <artifactId>jbpm-workitems-bpmn2</artifactId>
          <type>zip</type>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.jbpm</groupId>
          <artifactId>jbpm-workitems-email</artifactId>
          <type>zip</type>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.jbpm</groupId>
          <artifactId>jbpm-workitems-jms</artifactId>
          <type>zip</type>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.jbpm</groupId>
          <artifactId>jbpm-workitems-rest</artifactId>
          <type>zip</type>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.jbpm</groupId>
          <artifactId>jbpm-workitems-webservice</artifactId>
          <type>zip</type>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.jbpm.contrib</groupId>
          <artifactId>kafka-workitem</artifactId>
          <type>zip</type>
          <scope>provided</scope>
        </dependency>
      </dependencies>
    
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <configuration>
              <systemPropertyVariables>
                <total.mod.count>7</total.mod.count>
                <total.wi.count>16</total.wi.count>
              </systemPropertyVariables>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
