<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.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>7</version>
    </parent>

    <groupId>se.natusoft.tools.optionsmgr</groupId>
    <artifactId>OptionsManager</artifactId>
    <packaging>jar</packaging>
    <version>2.0</version>
    <name>OptionsManager</name>

    <url>http://github.com/tombensve/OptionsManager</url>

    <!--
        Project Information
    -->
    <description>
        Manages application/tool options. Options are mapped to Java Bean properties
        using annotations. Help texts can be specified for options also using
        annotations and a complete help text can be generated by the options manager.
        Options can be loaded from command line arg String[] array, an XML file, or a
        java properties file.
    </description>
    <properties>
        <copyrightYear>2009</copyrightYear>
        <copyrightHolder>Natusoft AB</copyrightHolder>
        <copyrightHolderWeb>http://www.natusoft.se/</copyrightHolderWeb>
    </properties>
    <licenses>
        <license>
            <name>Apache 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
        </license>
    </licenses>
    <organization>
        <name>${copyrightHolder}</name>
        <url>${copyrightHolderWeb}</url>
    </organization>
    <inceptionYear>${copyrightYear}</inceptionYear>
    <developers>
        <developer>
            <name>Tommy Svensson</name>
            <email>tommy@natusoft.se</email>
        </developer>
    </developers>

    <scm>
        <url>https://github.com/tombensve/OptionsManager.git</url>
        <connection>scm:git:git@github.com:tombensve/OptionsManager.git</connection>
        <developerConnection>scm:git:git@github.com:tombensve/OptionsManager.git</developerConnection>
    </scm>

    <!--
        Dependencies
    -->
    <dependencies>
        <dependency>
            <groupId>se.natusoft.tools.codelicmgr</groupId>
            <artifactId>CodeLicenseManager-annotations-retention-source</artifactId>
            <version>2.0</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.5</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <!--
        Building
    -->
    <build>
        <plugins>
            <!--
                Setup for java 5.
            -->
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>

            <!--
                Define project assemblies.
            -->
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <!--version>2.2-beta-5</version-->
                <configuration>
                    <descriptors>
                        <descriptor>file:${basedir}/src/assembly/bin-dist.xml</descriptor>
                    </descriptors>
                </configuration>
            </plugin>

            <!--
                Force checksums when installing to repository.

                I suspect that this might be unneccesarry since I think
                deploy creates checksums anyhow when deploying to external
                repository.
            -->
            <plugin>
                <artifactId>maven-install-plugin</artifactId>
                <configuration>
                    <createChecksum>true</createChecksum>
                </configuration>
            </plugin>

            <!--
                Copy relevant license files to target on install.
            -->
            <plugin>
                <groupId>se.natusoft.tools.codelicmgr</groupId>
                <artifactId>CodeLicenseManager-maven-plugin</artifactId>
                <version>2.0</version>

                <dependencies>
                    <dependency>
                        <groupId>se.natusoft.tools.codelicmgr</groupId>
                        <artifactId>CodeLicenseManager-licenses-common-opensource</artifactId>
                        <version>2.0</version>
                    </dependency>
                </dependencies>

                <executions>
                    <execution>
                        <id>apply-licence-info</id>
                        <goals>
                            <goal>install</goal>
                        </goals>
                        <phase>install</phase>
                        <configuration>

                            <installOptions>
                                <verbose>true</verbose>
                                <licenseDir>target/license</licenseDir>
                                <thirdpartyLicenseDir>target/license/thirdparty</thirdpartyLicenseDir>
                            </installOptions>

                            <createLicensesMarkdown>true</createLicensesMarkdown>
                            <markdownTargetSubdir>docs</markdownTargetSubdir>
                            <markdownLinkPrefix>https://github.com/tombensve/OptionsManager/blob/master/docs/</markdownLinkPrefix>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>se.natusoft.tools.doc.markdowndoc</groupId>
                <artifactId>markdowndoc-maven-plugin</artifactId>
                <version>1.0</version>

                <dependencies>
                    <dependency>
                        <groupId>se.natusoft.tools.doc.markdowndoc</groupId>
                        <artifactId>markdown-doc-lib</artifactId>
                        <version>1.0</version>
                    </dependency>
                </dependencies>

                <executions>
                    <execution>
                        <id>generate-docs</id>
                        <goals>
                            <goal>doc</goal>
                        </goals>
                        <phase>install</phase>
                        <configuration>

                            <generatorOptions>
                                <generator>pdf</generator>
                                <inputPaths>
                                    docs/UserGuide.md,
                                    docs/parts/H1Licenses.mdpart,
                                    docs/licenses.md,
                                    docs/parts/H1LicenseTexts.mdpart,
                                    docs/.*-.*.md
                                </inputPaths>
                            </generatorOptions>

                            <pdfGeneratorOptions>
                                <resultFile>docs/OptionsManager-User-Guide.pdf</resultFile>
                                <pageSize>A4</pageSize>
                                <title>Options Manager</title>
                                <subject>User Guide</subject>
                                <version>2.0</version>
                                <author>Tommy Svensson</author>
                                <copyright>Copyright © 2012 Natusoft AB</copyright>
                                <generateTitlePage>true</generateTitlePage>
                                <generateTOC>true</generateTOC>
                            </pdfGeneratorOptions>

                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>

    <!--
        Profiles
    -->
    <profiles>
        <profile>
            <!--
                This profile runs the CodeLicenseManager maven plugin and updates the source code
                with relevant information specified in this pom.
            -->
            <id>apply-licence-info</id>
            <build>
                <plugins>
                    <plugin>

                        <groupId>se.natusoft.tools.codelicmgr</groupId>
                        <artifactId>CodeLicenseManager-maven-plugin</artifactId>
                        <version>2.0</version>

                        <dependencies>
                            <dependency>
                                <groupId>se.natusoft.tools.codelicmgr</groupId>
                                <artifactId>CodeLicenseManager-licenses-common-opensource</artifactId>
                                <version>2.0</version>
                            </dependency>
                            <dependency><!-- Since there is also a java updater in the below updater this must be specified fist to override the other. -->
                                <groupId>se.natusoft.tools.codelicmgr</groupId>
                                <artifactId>CodeLicenseManager-source-updater-java-annotation</artifactId>
                                <version>2.0</version>
                            </dependency>
                            <dependency><!-- This is used for CSS. -->
                                <groupId>se.natusoft.tools.codelicmgr</groupId>
                                <artifactId>CodeLicenseManager-source-updater-slashstar-comment</artifactId>
                                <version>2.0</version>
                            </dependency>
                            <dependency>
                                <groupId>se.natusoft.tools.codelicmgr</groupId>
                                <artifactId>CodeLicenseManager-source-updater-html-xml</artifactId>
                                <version>2.0</version>
                            </dependency>
                        </dependencies>

                        <configuration>

                            <!-- All options are optional. -->
                            <codeOptions>
                                <verbose>true</verbose>
                                <!-- If not set uses extension on source file to resolve. -->
                                <codeLanguage><!-- by source extension. --></codeLanguage>
                                <!-- If true updates the license information in source code. -->
                                <updateLicenseInfo>true</updateLicenseInfo>
                                <!-- If true updates the copyright information in source code. -->
                                <updateCopyright>true</updateCopyright>
                                <!-- If true updates the project information in source code. -->
                                <updateProject>true</updateProject>
                                <!-- If true will add authors information to source files that does not have it. This is not always implemented! -->
                                <addAuthorsBlock>true</addAuthorsBlock>
                                <!-- The directories to scan for source code to update with project & license information. -->
                                <sourceCodeDirs>
                                    src/main/java/**/.*.java,src/main/css/.*.css,src/assembly/**/.*.xml
                                </sourceCodeDirs>

                            </codeOptions>

                            <!--userData>
                                <name>defaultAuthor</name><value>Tommy Svensson</value>
                                <name>defaultAuthorEmail</name><value>tommy@natusoft.se</value>
                            </userData-->

                        </configuration>

                        <executions>
                            <execution>
                                <id>apply-licence-info</id>
                                <goals>
                                    <goal>apply</goal>
                                </goals>
                                <phase>generate-sources</phase>
                            </execution>
                        </executions>

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

        <profile>
            <id>release-sign-artifacts</id>
            <activation>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.4</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>sonaify</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>se.natusoft.tools.fileeditor</groupId>
                        <artifactId>file-editor-maven-support-plugin</artifactId>
                        <version>1.0</version>

                        <dependencies>
                            <dependency>
                                <groupId>se.natusoft.tools.fileeditor</groupId>
                                <artifactId>file-editor-maven-support-scripts</artifactId>
                                <version>1.0</version>
                            </dependency>
                        </dependencies>
                        <executions>
                            <execution>
                                <id>upd-parent-and-snapshot</id>
                                <goals>
                                    <goal>edit</goal>
                                </goals>
                                <phase>generate-sources</phase>
                                <inherited>true</inherited>
                                <configuration>
                                    <scripts>
                                        <script>
                                            <forArtifactId>OptionsManager</forArtifactId>
                                            <scriptFile>script:pom_add_parent.bsh</scriptFile>
                                            <sourcePath>${basedir}/pom.xml</sourcePath>
                                            <variables>
                                                <variable>
                                                    <name>groupId</name>
                                                    <value>org.sonatype.oss</value>
                                                </variable>
                                                <variable>
                                                    <name>artifactId</name>
                                                    <value>oss-parent</value>
                                                </variable>
                                                <variable>
                                                    <name>version</name>
                                                    <value>7</value>
                                                </variable>
                                            </variables>
                                        </script>
                                        <script>
                                            <forArtifactId>OptionsManager</forArtifactId>
                                            <scriptFile>script:pom_add_snapshot_to_version.bsh</scriptFile>
                                            <sourcePath>${basedir}/pom.xml</sourcePath>
                                        </script>
                                    </scripts>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
