<?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>

  <parent>
    <groupId>org.chorem</groupId>
    <artifactId>lima</artifactId>
    <version>0.7.3</version>
  </parent>

  <groupId>org.chorem.lima</groupId>
  <artifactId>lima-swing</artifactId>

  <name>Lima :: Swing</name>
  <description>Lima main interface in Swing</description>

  <properties>
    <!--Main class in JAR -->
    <maven.jar.main.class>org.chorem.lima.LimaMain</maven.jar.main.class>

    <redmine.releaseFiles>
      target/lima-${project.version}-bin.zip
    </redmine.releaseFiles>

    <!--license.generateBundle>true</license.generateBundle-->
    <license.bundleLicensePath>
      META-INF/lima-LICENSE.txt
    </license.bundleLicensePath>
    <license.bundleThirdPartyPath>
      META-INF/lima-THIRD-PARTY.txt
    </license.bundleThirdPartyPath>

    <i18n.bundles>fr_FR,en_GB</i18n.bundles>
    <i18n.bundleOutputName>lima</i18n.bundleOutputName>

    <!-- uses some sun.xxx classes -->
    <signatureArtifactId>java16-sun</signatureArtifactId>
    <signatureVersion>1.10</signatureVersion>

    <!-- Post Release configuration -->
    <skipPostRelease>false</skipPostRelease>

  </properties>

  <dependencies>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>lima-business-api</artifactId>
      <version>${project.version}</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>lima-business</artifactId>
      <version>${project.version}</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>lima-callao</artifactId>
      <version>${project.version}</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.nuiton.jaxx</groupId>
      <artifactId>jaxx-runtime</artifactId>
      <exclusions>
        <exclusion>
          <groupId>javax.help</groupId>
          <artifactId>javahelp</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.nuiton.jaxx</groupId>
      <artifactId>jaxx-widgets</artifactId>
    </dependency>

    <dependency>
      <groupId>org.nuiton.jaxx</groupId>
      <artifactId>jaxx-config</artifactId>
    </dependency>

    <dependency>
      <groupId>org.swinglabs</groupId>
      <artifactId>jxlayer</artifactId>
    </dependency>

    <dependency>
      <groupId>org.nuiton</groupId>
      <artifactId>nuiton-utils</artifactId>
    </dependency>

    <dependency>
      <groupId>org.nuiton</groupId>
      <artifactId>nuiton-config</artifactId>
    </dependency>

    <dependency>
      <groupId>org.nuiton</groupId>
      <artifactId>nuiton-decorator</artifactId>
    </dependency>

    <dependency>
      <groupId>org.nuiton.i18n</groupId>
      <artifactId>nuiton-i18n</artifactId>
    </dependency>

    <dependency>
      <groupId>org.swinglabs.swingx</groupId>
      <artifactId>swingx-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.swinglabs.swingx</groupId>
      <artifactId>swingx-autocomplete</artifactId>
    </dependency>
    <dependency>
      <groupId>org.swinglabs.swingx</groupId>
      <artifactId>swingx-painters</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-email</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
    </dependency>

    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
    </dependency>

    <!--  for remote mode only -->
    <dependency>
      <groupId>org.apache.openejb</groupId>
      <artifactId>openejb-client</artifactId>
      <scope>runtime</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.openejb</groupId>
      <artifactId>openejb-loader</artifactId>
      <scope>runtime</scope>
    </dependency>

    <dependency>
      <groupId>org.nuiton</groupId>
      <artifactId>nuiton-widgets</artifactId>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
    </dependency>

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

  </dependencies>

  <build>

    <!--  be carefull with filtering, can break release -->
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <includes>
          <include>lima-config.properties</include>
        </includes>
        <filtering>true</filtering>
      </resource>
      <resource>
        <directory>src/main/resources</directory>
        <excludes>
          <exclude>lima-config.properties</exclude>
        </excludes>
      </resource>
    </resources>
    <pluginManagement>
      <plugins>

        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <configuration>
            <archive>
              <manifest>
                <addClasspath>true</addClasspath>
                <classpathPrefix>./lib/</classpathPrefix>
              </manifest>
              <manifestEntries>
                <SplashScreen-Image>icons/puzzle_splash.png</SplashScreen-Image>
              </manifestEntries>
            </archive>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>webstart-maven-plugin</artifactId>
          <configuration>
            <gzip>true</gzip>
            <unsign>true</unsign>
            <canUnsign>false</canUnsign>
            <!-- not possible to use pack200 while having some extensions -->
            <pack200><enabled>false</enabled></pack200>
            <jnlpExtensions>
              <jnlpExtension>
                <name>jxlayer</name>
                <title>Swing labs JXLayer</title>
                <vendor>Swing Labs</vendor>
                <includes>
                  <include>org.swinglabs:jxlayer</include>
                </includes>
              </jnlpExtension>
              <jnlpExtension>
                <name>jetty</name>
                <title>Jetty</title>
                <vendor>IBM Corporation</vendor>
                <includes>
                  <include>org.eclipse.jetty.orbit:javax.servlet</include>
                </includes>
              </jnlpExtension>
            </jnlpExtensions>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>

      <plugin>
        <groupId>org.nuiton.jaxx</groupId>
        <artifactId>jaxx-maven-plugin</artifactId>
        <configuration>
          <addCompileClassPath>true</addCompileClassPath>
          <addProjectClassPath>true</addProjectClassPath>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>generate</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.nuiton.i18n</groupId>
        <artifactId>i18n-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>scan-sources</id>
            <goals>
              <goal>parserJava</goal>
              <goal>gen</goal>
            </goals>
            <configuration>
              <entries>
                <entry>
                  <basedir>${maven.gen.dir}/java/</basedir>
                </entry>
              </entries>
            </configuration>
          </execution>
          <execution>
            <id>make-bundle</id>
            <goals>
              <goal>bundle</goal>
            </goals>
            <configuration>
              <generateCsvFile>true</generateCsvFile>
              <bundleCsvFile>${project.build.directory}/lima-i18n.csv
              </bundleCsvFile>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-dependencies</id>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
              <overWriteReleases>false</overWriteReleases>
              <overWriteSnapshots>true</overWriteSnapshots>
              <overWriteIfNewer>true</overWriteIfNewer>
              <outputDirectory>${project.build.directory}/lib</outputDirectory>
              <silent>true</silent>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>license-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-licenses</id>
            <goals>
              <goal>update-project-license</goal>
              <goal>add-third-party</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>

    <profile>
      <id>jnlp-reporting</id>
      <activation>
        <property>
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>
      <reporting>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>webstart-maven-plugin</artifactId>
            <version>${webstartPluginVersion}</version>
          </plugin>
        </plugins>
      </reporting>

    </profile>

    <profile>
      <id>jnlp-profile</id>
      <activation>
        <property>
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>

          <!-- key store secrets availables -->
          <plugin>
            <groupId>org.nuiton</groupId>
            <artifactId>helper-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>get-keystore</id>
                <goals>
                  <goal>share-server-secret</goal>
                </goals>
                <phase>package</phase>
                <configuration>
                  <serverId>codelutin-keystore</serverId>
                  <privateKeyOut>keystorepath</privateKeyOut>
                  <passwordOut>keystorepass</passwordOut>
                  <usernameOut>keyalias</usernameOut>
                  <passphraseOut>keypass</passphraseOut>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <!-- make webstart  -->
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>webstart-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>generate-jnlp</id>
                <phase>package</phase>
                <goals>
                  <goal>jnlp-inline</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- just add to buil the local webstart (codebase will be in target/jnlp) -->
    <profile>
      <id>local-jnlp-profile</id>
      <activation>
        <property>
          <name>doLocalWebstart</name>
          <value>true</value>
        </property>
      </activation>
      <properties>
        <jnlp.codebase>file://${project.build.directory}/jnlp</jnlp.codebase>
      </properties>
      <build>
        <defaultGoal>verify</defaultGoal>
        <plugins>

          <plugin>
            <groupId>org.nuiton</groupId>
            <artifactId>helper-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>get-keystore</id>
                <goals>
                  <goal>share-server-secret</goal>
                </goals>
                <phase>package</phase>
                <configuration>
                  <serverId>codelutin-keystore</serverId>
                  <privateKeyOut>keystorepath</privateKeyOut>
                  <passwordOut>keystorepass</passwordOut>
                  <usernameOut>keyalias</usernameOut>
                  <passphraseOut>keypass</passphraseOut>
                </configuration>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>webstart-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>generate-jnlp-local</id>
                <phase>package</phase>
                <goals>
                  <goal>jnlp-inline</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

        </plugins>
      </build>
    </profile>


    <profile>
      <id>assembly-profile</id>
      <activation>
        <property>
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>

          <plugin>
            <groupId>org.bluestemsoftware.open.maven.plugin</groupId>
            <artifactId>launch4j-plugin</artifactId>
            <executions>
              <execution>
                <id>launch4j</id>
                <phase>package</phase>
                <goals>
                  <goal>launch4j</goal>
                </goals>
                <configuration>
                  <dontWrapJar>true</dontWrapJar>
                  <headerType>gui</headerType>
                  <outfile>target/lima.exe</outfile>
                  <jar>lima.jar</jar>
                  <errTitle>${project.name}</errTitle>
                  <jre>
                    <minVersion>1.6.0</minVersion>
                  </jre>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
              <finalName>lima-${project.version}</finalName>
              <descriptors>
                <descriptor>src/main/assembly/bin.xml</descriptor>
              </descriptors>
              <attach>false</attach>
            </configuration>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>reporting</id>
      <activation>
        <property>
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>

      <reporting>
        <plugins>
          <plugin>
            <artifactId>maven-project-info-reports-plugin</artifactId>
            <version>${projectInfoReportsPluginVersion}</version>
            <reportSets>
              <reportSet>

                <reports>
                  <report>index</report>
                  <report>project-team</report>
                  <report>mailing-list</report>
                  <report>cim</report>
                  <report>issue-tracking</report>
                  <report>license</report>
                  <report>scm</report>
                  <report>dependency-convergence</report>
                  <report>dependency-management</report>
                </reports>
              </reportSet>
            </reportSets>
          </plugin>
        </plugins>
      </reporting>

    </profile>
  </profiles>
</project>
