You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by jo...@apache.org on 2015/07/25 11:20:34 UTC
struts git commit: WW-4522 Support latest stable AngularJS version in
maven angularjs archetype
Repository: struts
Updated Branches:
refs/heads/master 775c82a74 -> 5cf0671b6
WW-4522 Support latest stable AngularJS version in maven angularjs archetype
- Add maven plugin for automatic concatenating and minifying of resources during build
Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/5cf0671b
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/5cf0671b
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/5cf0671b
Branch: refs/heads/master
Commit: 5cf0671b60df6ef06e8c6c0c714afdbfe52f1235
Parents: 775c82a
Author: Johannes Geppert <jo...@apache.org>
Authored: Sat Jul 25 11:20:30 2015 +0200
Committer: Johannes Geppert <jo...@apache.org>
Committed: Sat Jul 25 11:20:30 2015 +0200
----------------------------------------------------------------------
.../main/resources/archetype-resources/pom.xml | 45 ++++++++++++++++++++
.../main/java/actions/ApplicationAction.java | 34 +++------------
.../main/webapp/WEB-INF/content/application.jsp | 22 ++++++----
.../java/actions/ApplicationActionTest.java | 4 +-
4 files changed, 67 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/struts/blob/5cf0671b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/pom.xml
----------------------------------------------------------------------
diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/pom.xml b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/pom.xml
index 274c591..7fc4ff7 100644
--- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/pom.xml
+++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/pom.xml
@@ -114,6 +114,51 @@
</configuration>
</plugin>
<plugin>
+ <groupId>com.samaxes.maven</groupId>
+ <artifactId>minify-maven-plugin</artifactId>
+ <version>1.7.4</version>
+ <executions>
+ <execution>
+ <id>external-minify</id>
+ <phase>package</phase>
+ <configuration>
+ <jsEngine>CLOSURE</jsEngine>
+ <closureLanguage>ECMASCRIPT5_STRICT</closureLanguage>
+ <skipMinify>true</skipMinify>
+ <jsFinalFile>external.js</jsFinalFile>
+ <jsSourceFiles>
+ <jsSourceFile>lib/angular/angular.min.js</jsSourceFile>
+ <jsSourceFile>lib/angular/angular-route.min.js</jsSourceFile>
+ </jsSourceFiles>
+ </configuration>
+ <goals>
+ <goal>minify</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>application-minify</id>
+ <phase>package</phase>
+ <configuration>
+ <jsEngine>CLOSURE</jsEngine>
+ <closureLanguage>ECMASCRIPT5_STRICT</closureLanguage>
+ <jsFinalFile>application.js</jsFinalFile>
+ <jsSourceFiles>
+ <jsSourceFile>app.js</jsSourceFile>
+ <jsSourceFile>config.js</jsSourceFile>
+ </jsSourceFiles>
+ <jsSourceIncludes>
+ <jsSourceInclude>services/*.js</jsSourceInclude>
+ <jsSourceInclude>controllers/*.js</jsSourceInclude>
+ </jsSourceIncludes>
+
+ </configuration>
+ <goals>
+ <goal>minify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.16.v20140903</version>
http://git-wip-us.apache.org/repos/asf/struts/blob/5cf0671b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/java/actions/ApplicationAction.java
----------------------------------------------------------------------
diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/java/actions/ApplicationAction.java b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/java/actions/ApplicationAction.java
index 4ed1ab9..b6440cc 100644
--- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/java/actions/ApplicationAction.java
+++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/java/actions/ApplicationAction.java
@@ -1,6 +1,4 @@
/*
- * $Id$
- *
* 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
@@ -29,36 +27,18 @@ public class ApplicationAction extends ActionSupport {
private static final long serialVersionUID = -3243216917801206214L;
+ private boolean useMinifiedResources = false;
+
public String execute() throws Exception {
- setMessage(getText(MESSAGE));
return SUCCESS;
}
- /**
- * Provide default valuie for Message property.
- */
- public static final String MESSAGE = "hello.message";
-
- /**
- * Field for Message property.
- */
- private String message;
-
- /**
- * Return Message property.
- *
- * @return Message property
- */
- public String getMessage() {
- return message;
+ public boolean isUseMinifiedResources() {
+ return useMinifiedResources;
}
- /**
- * Set Message property.
- *
- * @param message Text to display on HelloWorld page.
- */
- public void setMessage(String message) {
- this.message = message;
+ public void setUseMinifiedResources(boolean useMinifiedResources) {
+ this.useMinifiedResources = useMinifiedResources;
}
+
}
http://git-wip-us.apache.org/repos/asf/struts/blob/5cf0671b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/application.jsp
----------------------------------------------------------------------
diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/application.jsp b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/application.jsp
index 8d13a8d..6f5eac7 100644
--- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/application.jsp
+++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/application.jsp
@@ -20,13 +20,19 @@
<div ng-view></div>
</div>
-<script src="<s:url value="js/lib/angular/angular.min.js" />"></script>
-<script src="<s:url value="js/lib/angular/angular-route.min.js" />"></script>
-<script src="<s:url value="js/app.js" />"></script>
-<script src="<s:url value="js/config.js" />"></script>
-<script src="<s:url value="js/services/DataService.js" />"></script>
-<script src="<s:url value="js/controllers/AppController.js" />"></script>
-<script src="<s:url value="js/controllers/HomeController.js" />"></script>
-<script src="<s:url value="js/controllers/ApacheProjectsController.js" />"></script>
+<s:if test="useMinifiedResources">
+ <script src="<s:url value="js/external.js" />"></script>
+ <script src="<s:url value="js/application.js" />"></script>
+</s:if>
+<s:else>
+ <script src="<s:url value="js/lib/angular/angular.min.js" />"></script>
+ <script src="<s:url value="js/lib/angular/angular-route.min.js" />"></script>
+ <script src="<s:url value="js/app.js" />"></script>
+ <script src="<s:url value="js/config.js" />"></script>
+ <script src="<s:url value="js/services/DataService.js" />"></script>
+ <script src="<s:url value="js/controllers/AppController.js" />"></script>
+ <script src="<s:url value="js/controllers/HomeController.js" />"></script>
+ <script src="<s:url value="js/controllers/ApacheProjectsController.js" />"></script>
+</s:else>
</body>
</html>
http://git-wip-us.apache.org/repos/asf/struts/blob/5cf0671b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/test/java/actions/ApplicationActionTest.java
----------------------------------------------------------------------
diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/test/java/actions/ApplicationActionTest.java b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/test/java/actions/ApplicationActionTest.java
index 0933a81..2bef998 100644
--- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/test/java/actions/ApplicationActionTest.java
+++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/test/java/actions/ApplicationActionTest.java
@@ -1,6 +1,4 @@
/*
- * $Id$
- *
* 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
@@ -29,6 +27,6 @@ public class ApplicationActionTest extends StrutsTestCase {
ApplicationAction hello = new ApplicationAction();
String result = hello.execute();
assertTrue("Expected a success result!", ActionSupport.SUCCESS.equals(result));
- assertTrue("Expected the default message!", hello.getText(ApplicationAction.MESSAGE).equals(hello.getMessage()));
+ assertFalse(hello.isUseMinifiedResources());
}
}