<?xml version="1.0" encoding="UTF-8"?>
<!--
 | Licensed to Jasig under one or more contributor license
 | agreements. See the NOTICE file distributed with this work
 | for additional information regarding copyright ownership.
 | Jasig 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:
 |
 | 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>35</version>
    </parent>

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

    <properties>
    	<resource-server.version>1.0.42</resource-server.version>
    	<spring.version>3.1.3.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>
    </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.1.2</tag>
  </scm>

    <repositories>
        <repository>
            <id>jasig-repository</id>
            <name>JA-SIG Maven2 Repository</name>
            <url>http://developer.ja-sig.org/maven2</url>
        </repository>
        <repository>
            <id>Codehaus Snapshots</id>
            <url>http://snapshots.repository.codehaus.org/</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <releases>
                <enabled>false</enabled>
            </releases>
        </repository>
    </repositories>

    <dependencies>

        <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.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.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>3.3.2.GA</version>
        </dependency>

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

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

        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.14</version>
            <type>jar</type>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.5.2</version>
        </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>
        -->

        <dependency>
            <groupId>rome</groupId>
            <artifactId>rome</artifactId>
            <version>0.9</version>
            <type>jar</type>
        </dependency>

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

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

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.4</version>
            <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>4.11</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.maven-license-plugin</groupId>
                <artifactId>maven-license-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>
                    </excludes>
                    <mapping>
                        <tld>XML_STYLE</tld>
                        <tag>DYNASCRIPT_STYLE</tag>
                    </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.6</source>
                    <target>1.6</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/bootstrap-namespaced/3.1.1/</include>
                                <include>rs/fontawesome/4.0.3/</include>
                                <include>rs/jquery/1.10.2/</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>
            <plugin>
                <!--
                 | Invoke this plugin as follows to drop and recreate the Announcements database tables...
                 |
                 |   >mvn db-init
                 +-->
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>hibernate3-maven-plugin</artifactId>
                <version>2.2</version>
                <executions>
                    <execution>
                        <phase>db-init</phase>
                        <goals>
                            <goal>hbm2ddl</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <componentProperties>
                        <propertyfile>target/${project.artifactId}/WEB-INF/classes/datasource.properties</propertyfile>
                        <drop>true</drop>
                    </componentProperties>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>${jdbc.groupId}</groupId>
                        <artifactId>${jdbc.artifactId}</artifactId>
                        <version>${jdbc.version}</version>
                        <scope>compile</scope>
                    </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}" />
                                    <arg value="importExportContext.xml" />
                                </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}" />
                                    <arg value="importExportContext.xml" />
                                </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>1.5</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>
                    <includes>
                        <include>org/jasig/portlet/announcements/model/*.java</include>
                        <include>org/jasig/portlet/announcements/xml/*.java</include>
                    </includes>
                    <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>
        </plugins>
    </build>

</project>
