Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Code Block
# Should the deployment tools extract the WARs when copying them into the servlet container

extractWars=true

Adding Portlets to uPortal's Portlet Overlays

Although portlets may be manually deployed via the ant command described above, adopters may also instead choose to add a portlet to the uPortal build to be automatically deployed each time the "ant deploy-ear" task is run. This method also allows adopters to use vanilla versions of portlets from a public maven repository, then create "overlays" for any files requiring customization. By following this strategy, adopters no longer need to maintain custom separate portlet projects.

Add the portlet overlay

To add a portlet to the uPortal build as an overlay, first create a folder inside uPortal-3.2.x/uportal-portlets-overlay. If I were adding the Jasig Announcements portlet to the overlay, I might name the folder "Announcements". Next, create a POM file for this portlet.

In the top level of the portlet, create a file named "pom.xml". This file will use the main portal pom as its parent and use the portal's version as its version. The project will declare the desired portlet as a dependency. The groupId and artifactId of the dependency should match those of the project itself. The artifactId for the module can be whatever you'd like, but it's easiest to make it the same as the project.

Code Block
xml
xml

<?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/maven-v4_0_0.xsd">

    <parent>
        <groupId>org.jasig.portal.portlets-overlay</groupId>
        <artifactId>uportal-portlets-overlay-parent</artifactId>
        <version>3.2.5-SNAPSHOT</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>Announcements</artifactId>
    <packaging>war</packaging>

    <name>Announcements Portlet</name>
    <description>Overlay on Bookmarks Portlet.</description>

    <dependencies>
        <!-- ===== Compile Time Dependencies ============================== -->
        <dependency>
            <groupId>org.jasig.portlet</groupId>
            <artifactId>Announcements</artifactId>
            <version>${AnnouncementsPortlet.version}</version>
            <type>war</type>
        </dependency>

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

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

Add a property named "AnnouncementsPortlet.version" to the main uPortal pom file. This will allow the version to be easily updated in the future. To do this, open uPortal/pom.xml and locate the <properties/> element. Add a new property to indicate the version of the Announcements portlet:

Code Block
xml
xml

<properties>

        . . .

        <!-- WAR Dependency Version Properties -->
        . . .
        <AnnouncementsPortlet.version>1.1-M1</AnnouncementsPortlet.version>
        . . .
    </properties>

The new overlay needs to be added to the overlays project pom as a module. Open uPortal-3.2.x/uportal-portlets-overlay/pom.xml and add your new folder as a dependency:

Code Block
xml
xml

<?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/maven-v4_0_0.xsd">

    . . .

    <modules>
        <module>BookmarksPortlet</module>
        . . .
        <module>Announcements</module>
    </modules>

    . . .

</project>

Add the overlay as a dependency of the uportal-ear project

Once you've created your new overlay, it needs to be added to the uportal ear file. To do this, add the new module as a dependency in uportal/uportal-ear/pom.xml:

Code Block
xml
xml

<?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/maven-v4_0_0.xsd">

    . . .

    <dependencies>

        . . .

        <dependency>
            <groupId>org.jasig.portal.portlets-overlay</groupId>
            <artifactId>Announcements</artifactId>
            <version>${project.version}</version>
            <type>war</type>
        </dependency>

        . . .
    </dependencies>

    <build>
        <finalName>${uportal.docbase}</finalName>
        <plugins>
            <plugin>
                <artifactId>maven-deploy-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-ear-plugin</artifactId>
                <configuration>
                    <modules>
                        . . .
                        <webModule>
                            <groupId>org.jasig.portal.portlets-overlay</groupId>
                            <artifactId>Announcements</artifactId>
                            <bundleFileName>Announcements.war</bundleFileName>
                            <contextRoot>/Announcements</contextRoot>
                        </webModule>
                    </modules>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

Using uPortal's Maven Plugin