Skip to content

Commit

Permalink
WW-4522 Support latest stable AngularJS version in maven angularjs ar…
Browse files Browse the repository at this point in the history
…chetype

- Add maven plugin for automatic concatenating and minifying of resources during build
  • Loading branch information
jogep committed Jul 25, 2015
1 parent 775c82a commit 5cf0671
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -29,6 +27,6 @@ public void testApplicationAction() throws Exception {
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());
}
}

0 comments on commit 5cf0671

Please sign in to comment.