mirror of
https://github.com/apache/struts.git
synced 2026-08-05 22:56:59 +00:00
WW-4522 Support latest stable AngularJS version in maven angularjs archetype
- Add maven plugin for automatic concatenating and minifying of resources during build
This commit is contained in:
@@ -113,6 +113,51 @@
|
||||
<failOnError>true</failOnError>
|
||||
</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>
|
||||
|
||||
+7
-27
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+14
-8
@@ -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>
|
||||
|
||||
+1
-3
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user