You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rave.apache.org by ca...@apache.org on 2012/04/03 19:37:18 UTC

svn commit: r1309064 - in /rave/trunk/rave-portal-resources: pom.xml src/main/resources/wro.properties src/main/resources/wro.xml

Author: carlucci
Date: Tue Apr  3 17:37:18 2012
New Revision: 1309064

URL: http://svn.apache.org/viewvc?rev=1309064&view=rev
Log:
RAVE-520: concatenate and minify the Rave javascript files into one file and bundle it with the individual files in the war

Added:
    rave/trunk/rave-portal-resources/src/main/resources/wro.properties
    rave/trunk/rave-portal-resources/src/main/resources/wro.xml
Modified:
    rave/trunk/rave-portal-resources/pom.xml

Modified: rave/trunk/rave-portal-resources/pom.xml
URL: http://svn.apache.org/viewvc/rave/trunk/rave-portal-resources/pom.xml?rev=1309064&r1=1309063&r2=1309064&view=diff
==============================================================================
--- rave/trunk/rave-portal-resources/pom.xml (original)
+++ rave/trunk/rave-portal-resources/pom.xml Tue Apr  3 17:37:18 2012
@@ -76,6 +76,11 @@
             <resource>
                 <directory>src/main/resources</directory>
                 <filtering>true</filtering>
+                <!-- exclude the wro4j config files from the WAR as they are only needed for build -->
+                <excludes>
+                    <exclude>**/wro.properties</exclude>
+                    <exclude>**/wro.xml</exclude>
+                </excludes>
             </resource>
         </resources>
         <plugins>
@@ -111,12 +116,47 @@
                             <jsSrcDir>${project.basedir}/src/main/webapp/script/</jsSrcDir>
                             <debug>true</debug>
                             <sourceExcludes>
-                                  <exclude>rave_layout.js</exclude>
+                                <exclude>rave_layout.js</exclude>
+                                <!-- exclude the combined js file from our tests, created by the wro4j plugin  -->
+                                <exclude>all.min.js</exclude>
                             </sourceExcludes>
                         </configuration>
                     </execution>
                 </executions>
             </plugin>
+            <!--
+               wro4j maven plugin is used for optimization (concatenation, minification, etc) of our static resources
+               it is invoked as part of the compile phase of the maven lifecycle
+            -->
+            <plugin>
+                <groupId>ro.isdc.wro4j</groupId>
+                <artifactId>wro4j-maven-plugin</artifactId>
+                <version>1.4.4</version>
+                <executions>
+                    <execution>
+                        <phase>compile</phase>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <!-- wro.properties defines which pre and post processors to execute -->
+                    <extraConfigFile>${basedir}/src/main/resources/wro.properties</extraConfigFile>
+                    <!-- wro.xml defines the resource groups -->
+                    <wroFile>${basedir}/src/main/resources/wro.xml</wroFile>
+                    <!-- targetGroups is the set of resource groups, defined in wro.xml, that you want to process -->
+                    <targetGroups>rave_all.min</targetGroups>
+                    <!-- minimize instructs the processors to handle their minimization work -->
+                    <minimize>true</minimize>
+                    <!-- location of the javascript after processing -->
+                    <jsDestinationFolder>${project.build.directory}/${project.build.finalName}/script/</jsDestinationFolder>
+                    <!-- location of webapp directory that wro4j uses for its location context -->
+                    <contextFolder>${basedir}/src/main/webapp/</contextFolder>
+                    <wroManagerFactory>ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory</wroManagerFactory>
+                    <ignoreMissingResources>false</ignoreMissingResources>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 </project>

Added: rave/trunk/rave-portal-resources/src/main/resources/wro.properties
URL: http://svn.apache.org/viewvc/rave/trunk/rave-portal-resources/src/main/resources/wro.properties?rev=1309064&view=auto
==============================================================================
--- rave/trunk/rave-portal-resources/src/main/resources/wro.properties (added)
+++ rave/trunk/rave-portal-resources/src/main/resources/wro.properties Tue Apr  3 17:37:18 2012
@@ -0,0 +1,30 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF 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.
+#
+
+###
+# see http://code.google.com/p/wro4j/wiki/AvailableProcessors for the available wro4j processors that can be used
+###
+
+# defines which wro4j pre-processors to run against the combined resource group
+# by default no preProcessors are defined
+preProcessors=
+
+# defines which wro4j post-processors to run against the combined resource group
+# by default we are using the googleClosureSimple processor to reduce the size of the combined javascript
+postProcessors=googleClosureSimple
\ No newline at end of file

Added: rave/trunk/rave-portal-resources/src/main/resources/wro.xml
URL: http://svn.apache.org/viewvc/rave/trunk/rave-portal-resources/src/main/resources/wro.xml?rev=1309064&view=auto
==============================================================================
--- rave/trunk/rave-portal-resources/src/main/resources/wro.xml (added)
+++ rave/trunk/rave-portal-resources/src/main/resources/wro.xml Tue Apr  3 17:37:18 2012
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF 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.
+-->
+<groups xmlns="http://www.isdc.ro/wro">
+    <!-- defines a wro4j group called rave-all.min which represents all of our javascript files -->
+    <group name="rave_all.min">
+        <js>/script/*.js</js>
+    </group>
+</groups>
\ No newline at end of file