From 5cf0671b60df6ef06e8c6c0c714afdbfe52f1235 Mon Sep 17 00:00:00 2001 From: Johannes Geppert Date: Sat, 25 Jul 2015 11:20:30 +0200 Subject: [PATCH] WW-4522 Support latest stable AngularJS version in maven angularjs archetype - Add maven plugin for automatic concatenating and minifying of resources during build --- .../resources/archetype-resources/pom.xml | 45 +++++++++++++++++++ .../main/java/actions/ApplicationAction.java | 34 +++----------- .../webapp/WEB-INF/content/application.jsp | 22 +++++---- .../java/actions/ApplicationActionTest.java | 4 +- 4 files changed, 67 insertions(+), 38 deletions(-) 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 274c5912c..7fc4ff737 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 @@ -113,6 +113,51 @@ true + + com.samaxes.maven + minify-maven-plugin + 1.7.4 + + + external-minify + package + + CLOSURE + ECMASCRIPT5_STRICT + true + external.js + + lib/angular/angular.min.js + lib/angular/angular-route.min.js + + + + minify + + + + application-minify + package + + CLOSURE + ECMASCRIPT5_STRICT + application.js + + app.js + config.js + + + services/*.js + controllers/*.js + + + + + minify + + + + org.mortbay.jetty jetty-maven-plugin 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 4ed1ab900..b6440cc41 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; } + } 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 8d13a8da0..6f5eac784 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 @@
- - - - - - - - + + + + + + + + + + + + + + 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 0933a8191..2bef9988a 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()); } }