<?xml version="1.0" encoding="UTF-8"?>
<!--

    Licensed to Apereo under one or more contributor license
    agreements. See the NOTICE file distributed with this work
    for additional information regarding copyright ownership.
    Apereo 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.  You may obtain a
    copy of the License at the following location:

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

    <parent>
        <groupId>org.jasig.parent</groupId>
        <artifactId>jasig-parent</artifactId>
        <version>41</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <groupId>org.jasig.portlet</groupId>
    <artifactId>Announcements</artifactId>
    <packaging>war</packaging>
    <name>Announcements Portlet</name>
    <version>2.4.2</version>

    <properties>
        <junit.version>4.12</junit.version>
        <logback.version>1.2.0</logback.version>
        <resource-server.version>1.0.42</resource-server.version>
        <servlet-api.version>3.0.1</servlet-api.version>
        <spring.version>4.3.15.RELEASE</spring.version>

        <!-- The JDBC Driver used by the portlet -->
        <jdbc.groupId>org.hsqldb</jdbc.groupId>
        <jdbc.artifactId>hsqldb</jdbc.artifactId>
        <jdbc.version>2.2.9</jdbc.version>

        <!-- Utility libraries -->
        <jackson.version>2.9.5</jackson.version>
        <lombok.version>1.16.20</lombok.version>
    </properties>

    <url>http://www.ja-sig.org/wiki/display/PLT/Announcements+Portlet</url>

    <description>A set of portlets that facilitate the authoring, editing, publishing, and
        displaying of portal announcements.</description>

    <organization>
        <name>Jasig, Inc.</name>
        <url>http://www.jasig.org/</url>
    </organization>

    <developers>
        <developer>
            <id>eolsson</id>
            <name>Erik A. Olsson</name>
            <email>erik.olsson@uci.edu</email>
            <timezone>-8</timezone>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/Jasig/AnnouncementsPortlet.git</connection>
        <developerConnection>scm:git:git@github.com:Jasig/AnnouncementsPortlet.git</developerConnection>
        <url>https://github.com/Jasig/AnnouncementsPortlet</url>
        <tag>Announcements-2.4.2</tag>
    </scm>

    <repositories>
        <repository>
            <id>jasig-repository</id>
            <name>JA-SIG Maven2 Repository</name>
            <url>http://developer.ja-sig.org/maven2</url>
        </repository>
    </repositories>

    <dependencies>

        <dependency>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
            <version>3.2.2</version>
        </dependency>

        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.1</version>
        </dependency>

        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.1.9</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.1.2</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>taglibs</groupId>
            <artifactId>standard</artifactId>
            <version>1.1.2</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.jasig.portlet.notification</groupId>
            <artifactId>notification-portlet-api</artifactId>
            <version>2.0.0</version>
        </dependency>

        <dependency>
            <groupId>org.jasypt</groupId>
            <artifactId>jasypt-spring31</artifactId>
            <version>1.9.2</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc-portlet</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>${spring.version}</version>
         </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>3.6.10.Final</version>
        </dependency>

        <!-- Needed for schema reset;  version compatible with org.hibernate:hibernate-core:3.6.10.FINAL -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-tools</artifactId>
            <version>3.6.0.Final</version>
        </dependency>

        <dependency><!-- java bytecode processor required by hibernate-->
            <groupId>javassist</groupId>
            <artifactId>javassist</artifactId>
            <version>3.12.1.GA</version>
        </dependency>

        <dependency>
            <groupId>net.sf.ehcache</groupId>
            <artifactId>ehcache</artifactId>
            <version>2.8.5</version>
        </dependency>

        <dependency>
            <groupId>backport-util-concurrent</groupId>
            <artifactId>backport-util-concurrent</artifactId>
            <version>3.1</version>
        </dependency>

        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <version>1.4</version>
            <type>jar</type>
        </dependency>

        <dependency>
            <groupId>${jdbc.groupId}</groupId>
            <artifactId>${jdbc.artifactId}</artifactId>
            <version>${jdbc.version}</version>
        </dependency>

        <!-- Switch to MySQL by removing the dependency above and uncommenting the one below.
         |   Other changes also required to the datasource.properties file. See the wiki.
         -->

        <!--
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.12</version>
            <type>jar</type>
        </dependency>
        -->

        <!-- Utility libraries -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>${lombok.version}</version>
        </dependency>

        <dependency>
            <groupId>com.rometools</groupId>
            <artifactId>rome</artifactId>
            <version>1.5.0</version>
        </dependency>

        <dependency>
            <groupId>jdom</groupId>
            <artifactId>jdom</artifactId>
            <version>1.0</version>
            <type>jar</type>
        </dependency>

        <!-- ===== Runtime Dependencies ================================== -->

        <!-- Provides the PortalPropertySourcesPlaceholderConfigurer
             that supports global.properties and Jasypt encryption-->
        <dependency>
            <groupId>org.jasig.portal</groupId>
            <artifactId>uPortal-spring</artifactId>
            <version>5.1.1</version>
            <exclusions>
                <exclusion>
                    <groupId>org.jasig.portal</groupId>
                    <artifactId>uPortal-api-internal</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.jasig.portal</groupId>
                    <artifactId>uPortal-security-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.jasig.portal</groupId>
                    <artifactId>uPortal-security-mvc</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.jasig.portal</groupId>
                    <artifactId>uPortal-tools</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>net.oauth.core</groupId>
                    <artifactId>oauth</artifactId>
                </exclusion>
            </exclusions>
        </dependency>


        <!-- ======= Provided ============== -->

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>${servlet-api.version}</version>
            <type>jar</type>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>javax.portlet</groupId>
            <artifactId>portlet-api</artifactId>
            <version>2.0</version>
            <scope>provided</scope>
        </dependency>

        <!-- ===== Test Dependencies ====================================== -->

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.jasig.resourceserver</groupId>
            <artifactId>resource-server-content</artifactId>
            <version>${resource-server.version}</version>
            <type>war</type>
        </dependency>

        <dependency>
            <groupId>org.jasig.resourceserver</groupId>
            <artifactId>resource-server-utils</artifactId>
            <version>${resource-server.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-web</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-beans</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>jcl-over-slf4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <finalName>${project.artifactId}</finalName>
        <!-- textResources makes context files available to Spring integration tests -->
        <testResources>
            <testResource>
                <directory>src/main/webapp/WEB-INF</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/*.xml</include>
                    <include>**/*.properties</include>
                </includes>
            </testResource>
            <testResource>
                <directory>src/test/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/*.properties</include>
                </includes>
            </testResource>
        </testResources>
        <plugins>
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <configuration>
                    <basedir>${basedir}</basedir>
                    <header>${jasig-short-license-url}</header>
                    <aggregate>true</aggregate>
                    <excludes>
                        <exclude>.gitignore</exclude>
                        <exclude>.idea/**</exclude>  <!-- for intelliJ Idea -->
                        <exclude>overlays/**</exclude>  <!-- for intelliJ Idea -->
                        <exclude>LICENSE</exclude>
                        <exclude>NOTICE</exclude>
                        <exclude>**/src/main/webapp/js/**</exclude>
                        <exclude>**/src/main/webapp/rs/**</exclude>
                        <exclude>**/src/main/webapp/date-picker/**</exclude>
                        <exclude>**/src/main/webapp/tinymce/**</exclude>
                        <exclude>**/src/main/webapp/fonts/**</exclude>
                    </excludes>
                    <mapping>
                        <tld>XML_STYLE</tld>
                        <tag>DYNASCRIPT_STYLE</tag>
                        <less>DOUBLESLASH_STYLE</less>
                    </mapping>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.4.2</version>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.scm</groupId>
                        <artifactId>maven-scm-provider-gitexe</artifactId>
                        <version>1.9</version>
                    </dependency>
                </dependencies>
            </plugin>

            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>

                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>

                <configuration>
                    <warName>Announcements</warName>
                    <webXml>${basedir}/src/main/webapp/WEB-INF/web.xml</webXml>
                    <overlays>
                        <overlay>
                            <groupId>org.jasig.resourceserver</groupId>
                            <artifactId>resource-server-content</artifactId>
                            <includes>
                                <include>rs/jquery/1.11.0/</include>
                                <include>rs/jquery-migrate/</include>
                                <include>rs/jqueryui/1.10.3/</include>
                            </includes>
                        </overlay>
                    </overlays>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.15</version>
                <configuration>
                    <workingDirectory>src/main/webapp</workingDirectory>
                </configuration>
            </plugin>
            <!-- Plug-in to add lifecycles to support db-init, data-import, and data-export -->
            <plugin>
                <groupId>org.jasig.portal.maven</groupId>
                <artifactId>uportal-maven-plugin</artifactId>
                <version>1.0.0</version>
                <!-- extensions must be set to true to pick up the custom phases -->
                <extensions>true</extensions>
            </plugin>
            <!--
             | Invoke this plugin as follows to drop and recreate the Announcements database tables...
             |
             |   >mvn db-init
             +-->
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>schema-create</id>
                        <phase>db-init</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <property name="runtime_classpath" refid="maven.runtime.classpath" />
                                <property name="plugin_classpath" refid="maven.plugin.classpath" />

                                <java failonerror="true" classname="org.jasig.portlet.announcements.SchemaCreator">
                                    <classpath>
                                        <pathelement location="${project.build.directory}/${project.artifactId}/WEB-INF/context" />
                                        <pathelement path="${runtime_classpath}" />
                                        <pathelement path="${plugin_classpath}" />
                                    </classpath>
                                </java>
                            </tasks>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>javax.servlet</groupId>
                        <artifactId>javax.servlet-api</artifactId>
                        <version>${servlet-api.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>javax.portlet</groupId>
                        <artifactId>portlet-api</artifactId>
                        <version>2.0</version>
                    </dependency>
                </dependencies>
            </plugin>
            <!-- To import the announcement db tables, use mvn [-Ddir=dir] data-import -->
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>data-import</id>
                        <phase>data-import</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <!-- Set default value of data location if it is not set -->
                                <property name="dir" value="${basedir}/src/main/data" />

                                <property name="runtime_classpath" refid="maven.runtime.classpath" />
                                <property name="plugin_classpath" refid="maven.plugin.classpath" />

                                <!-- Provided jars aren't added to the runtime
                                     classpath, so we manually add in servlet.jar here  -->
                                <property name="servlet.jar" value="${maven.dependency.javax.servlet.servlet-api.jar.path}" />
                                <property name="portlet.jar" value="${maven.dependency.javax.portlet.portlet-api.jar.path}" />

                                <java failonerror="true" classname="org.jasig.portlet.announcements.Importer">
                                    <sysproperty key="log4j.configuration" value="command-line.log4j.properties" />
                                    <classpath>
                                        <pathelement location="${project.build.directory}/${project.artifactId}/WEB-INF/context" />
                                        <pathelement path="${runtime_classpath}" />
                                        <pathelement path="${plugin_classpath}" />
                                        <pathelement location="${servlet.jar}" />
                                        <pathelement location="${portlet.jar}" />
                                    </classpath>

                                    <arg value="${dir}" />
                                </java>
                            </tasks>
                        </configuration>
                    </execution>
                    <!-- Export not yet tested ... -->
                    <execution>
                        <id>data-export</id>
                        <phase>data-export</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>

                                <fail unless="dir">
                                    You must set the "dir" parameter.  (-Ddir={something})
                                </fail>

                                <property name="runtime_classpath" refid="maven.runtime.classpath" />
                                <property name="plugin_classpath" refid="maven.plugin.classpath" />
                                <!-- Provided jars don't seem to be added to the runtime
                                     classpath, so we manually add in servlet.jar here  -->
                                <property name="servlet.jar" value="${maven.dependency.javax.servlet.servlet-api.jar.path}" />
                                <property name="portlet.jar" value="${maven.dependency.javax.portlet.portlet-api.jar.path}" />

                                <java failonerror="true" fork="true" classname="org.jasig.portlet.announcements.Exporter">
                                    <sysproperty key="log4j.configuration" value="command-line.log4j.properties" />
                                    <classpath>
                                        <pathelement location="${project.build.directory}/${project.artifactId}/WEB-INF/context" />
                                        <pathelement path="${runtime_classpath}" />
                                        <pathelement path="${plugin_classpath}" />
                                        <pathelement location="${servlet.jar}" />
                                        <pathelement location="${portlet.jar}" />
                                    </classpath>

                                    <arg value="${dir}" />
                                </java>
                            </tasks>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>rhino</groupId>
                        <artifactId>js</artifactId>
                        <version>1.7R1</version>
                    </dependency>
                </dependencies>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jaxb2-maven-plugin</artifactId>
                <version>2.2</version>
                <executions>
                    <execution>
                        <id>schemagen</id>
                        <goals>
                            <goal>schemagen</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <transformSchemas>
                        <!--
                            Each schema element defines:

                            a) A <<namespace uri>> for one of your namespaces.
                               This namespace uri must be unique within the schemas element.

                            b) A <<toPrefix>> that you want to use for the namespace.
                               Should not contain whitespace or exotic characters.
                               This yields a namespace definition on the form
                               <xs:schema ... xmlns:[toPrefix]="[uri]" ... />

                               (I.e: <xs:schema ... xmlns:some="http://some/namespace" xmlns:xs="http://www.w3.org/2001/XMLSchema"> )

                               ... and transforms relevant xml schema elements to use the provided namespace prefix:

                               <some:elementName ... />

                            c) The desired <<toFile>> name of the generated XML schema definition file,
                               excluding the ".xsd" suffix (which will be added automatically).
                        -->
                        <transformSchema>
                            <uri>http://www.uPortal.org/schema/announcement/topic</uri>
                            <toPrefix>topic</toPrefix>
                            <toFile>topic.xsd</toFile>
                        </transformSchema>
                        <transformSchema>
                            <uri>http://www.uPortal.org/schema/announcement/topicSubscription</uri>
                            <toPrefix>subscription</toPrefix>
                            <toFile>topicSubscription.xsd</toFile>
                        </transformSchema>
                        <transformSchema>
                            <uri>http://www.uPortal.org/schema/announcement/announcement</uri>
                            <toPrefix>announcement</toPrefix>
                            <toFile>announcement.xsd</toFile>
                        </transformSchema>
                    </transformSchemas>
                    <schemaSourceExcludeFilters>
                      <limitIncludes implementation="org.codehaus.mojo.jaxb2.shared.filters.pattern.PatternFileFilter">
                        <patterns>
                            <pattern>\/mvc\/.*\.java</pattern>
                            <pattern>\\mvc\\.*\.java</pattern>
                            <pattern>\/service\/.*\.java</pattern>
                            <pattern>\\service\\.*\.java</pattern>
                            <pattern>\/spring\/.*\.java</pattern>
                            <pattern>\\spring\\.*\.java</pattern>
                            <pattern>Exporter\.java</pattern>
                            <pattern>Importer\.java</pattern>
                            <pattern>UnauthorizedException\.java</pattern>
                            <pattern>SchemaCreator\.java</pattern>
                            <pattern>ApplicationContextConnectionProvider\.java</pattern>
                            <pattern>AnnouncementValidator\.java</pattern>
                            <pattern>TopicValidator\.java</pattern>
                        </patterns>
                      </limitIncludes>
                    </schemaSourceExcludeFilters>
                    <outputDirectory>target/generated-schemas</outputDirectory>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.lesscss</groupId>
                <artifactId>lesscss-maven-plugin</artifactId>
                <version>1.3.3</version>
                <configuration>
                    <sourceDirectory>${project.basedir}/src/main/webapp/less</sourceDirectory>
                    <outputDirectory>${project.build.directory}/${project.build.finalName}/css</outputDirectory>
                    <compress>true</compress>
                    <includes>
                        <include>announcements.less</include>
                    </includes>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.9</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <additionalparam>-Xdoclint:none</additionalparam>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>2.17</version>
                <configuration>
                    <configLocation>google_checks.xml</configLocation>
                </configuration>
            </plugin>
        </plugins>
    </reporting>
</project>
