<!--
  Licensed to the Technische Universität Darmstadt under one
  or more contributor license agreements. See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership. The Technische Universität Darmstadt
  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.

  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.dkpro.jwpl</groupId>
    <artifactId>dkpro-jwpl-deps</artifactId>
    <version>2.0.0</version>
  </parent>
  <artifactId>dkpro-jwpl-swc-engine-shade</artifactId>
  <name>Dependencies :: Jakarta :: swc-engine</name>

  <properties>
    <mdep.analyze.skip>true</mdep.analyze.skip>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.sweble.wikitext</groupId>
      <artifactId>swc-engine</artifactId>
      <version>${org.sweble.wikitext.version}</version>
    </dependency>
    <dependency>
      <groupId>commons-collections</groupId>
      <artifactId>commons-collections</artifactId>
      <version>3.2.2</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>1.4</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>de.fau.cs.osr.ptk</groupId>
      <artifactId>ptk-common</artifactId>
    </dependency>
    <dependency>
      <groupId>de.fau.cs.osr.utils</groupId>
      <artifactId>utils</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.sweble.wikitext</groupId>
      <artifactId>swc-parser-lazy</artifactId>
    </dependency>
    <dependency>
      <groupId>xtc</groupId>
      <artifactId>rats-runtime</artifactId>
      <version>1.15.0</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <!-- This creates an empty javadoc file as required by OSS Sonatype -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <execution>
            <id>empty-javadoc-jar</id>
            <phase>package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <classifier>javadoc</classifier>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>3.5.1</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <createSourcesJar>true</createSourcesJar>
              <useBaseVersion>true</useBaseVersion>
              <createDependencyReducedPom>false</createDependencyReducedPom>
              <artifactSet>
                <includes>
                  <!-- only sweble engine to make sure we don't add other things -->
                  <include>org.sweble.wikitext:swc-engine:*</include> 
                </includes>
              </artifactSet>
              <filters>
                <filter>
                  <artifact>*:*</artifact>
                  <excludes>
                    <exclude>META-INF/MANIFEST.MF</exclude>
                    <exclude>META-INF/maven/**</exclude>
                    <exclude>org.sweble.wikitext/swc-engine/git.properties</exclude>
                  </excludes>
                </filter>
              </filters>
              <transformers>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
              </transformers>
              <relocations>
                <relocation>
                  <pattern>javax.xml.bind</pattern>
                  <shadedPattern>jakarta.xml.bind</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>org.sweble.wikitext.engine</pattern>
                  <shadedPattern>org.dkpro.jwpl.shade.org.sweble.wikitext.engine</shadedPattern>
                </relocation>
              </relocations>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <!--
          Purpose of build-helper-maven-plugin is to ensure that IntelliJ sees shaded
          classes.
          When navigating over to java classes, the shaded imported classes will
          show as resolved instead of unknown.
          The artifact specified below is created when this module built.
          But is also used to resolve classes in IntelliJ.
          "phase" is set to "none" - with this setting, the artifact jar will not be
          uploaded to repo
          when running standalone "mvn install" command.
          build-helper-maven-plugin can be removed completely with no effect on the 
          "mvn clean" and "mvn install",
          which is handled by maven-shade-plugin.
        -->
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>workaround-makeItVisibleOnIntellij</id>
            <phase>none</phase>
            <goals>
              <goal>attach-artifact</goal>
            </goals>
            <configuration>
              <artifacts>
                <artifact>
                  <file>${project.build.directory}/${project.build.finalName}.jar</file>
                  <type>jar</type>
                  <classifier>optional</classifier>
                </artifact>
              </artifacts>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>