Skip to content

Commit

Permalink
Add support for external bundle configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
samaxes committed Jan 6, 2015
1 parent 7144e81 commit f5b814c
Show file tree
Hide file tree
Showing 15 changed files with 294 additions and 595 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Expand Up @@ -2,5 +2,3 @@ target
.settings
.project
.classpath
.idea
*.iml
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,9 @@
# Minify Maven Plugin

## 1.7.5

* Add support for external bundle configuration (#57).

## 1.7.4

* Update Google Closure Compiler to v20140814 (#71).
Expand Down
39 changes: 17 additions & 22 deletions demo/pom.xml
Expand Up @@ -11,47 +11,30 @@
<packaging>war</packaging>

<name>Minify Maven Plugin Demo</name>
<description>How to use the maven plugin minify-maven-plugin.</description>
<description>Demonstrate how to use minify-maven-plugin.</description>
<url>https://github.com/samaxes/minify-maven-plugin</url>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
<version>3.2</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<version>2.5</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<warSourceExcludes>**/reset.css,**/fonts.css,**/base.css,**/toc.css,**/samaxesjs.core.js,**/samaxesjs.toc.js</warSourceExcludes>
</configuration>
</plugin>

<plugin>
<groupId>com.samaxes.maven</groupId>
<artifactId>minify-maven-plugin</artifactId>
<version>${project.version}</version>
<executions>
<execution>
<id>minify-via-aggregation-configuration</id>
<goals>
<goal>minify</goal>
</goals>
<configuration>
<bundleConfiguration>src/main/resources/static-bundles.json</bundleConfiguration>
<jsEngine>CLOSURE</jsEngine>
</configuration>
</execution>
<execution>
<id>default-minify</id>
<configuration>
Expand All @@ -76,13 +59,24 @@
<goal>minify</goal>
</goals>
</execution>
<execution>
<id>bundle-configuration-minify</id>
<configuration>
<bundleConfiguration>src/minify/static-bundles.json</bundleConfiguration>
<jsEngine>CLOSURE</jsEngine>
<closureCreateSourceMap>true</closureCreateSourceMap>
</configuration>
<goals>
<goal>minify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<!-- mvn assembly:single -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<version>2.5.3</version>
<configuration>
<descriptorRefs>
<descriptorRef>src</descriptorRef>
Expand All @@ -102,9 +96,10 @@
</dependencies>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<skipTests>true</skipTests>
</properties>
</project>
Expand Up @@ -11,13 +11,12 @@
]
},
{
"type": "javascript",
"type": "js",
"name": "static-combined.js",
"files": [
"samaxesjs.core.js",
"subdir/samaxesjs.toc.js"
]
}

]
}
40 changes: 13 additions & 27 deletions pom.xml
Expand Up @@ -106,12 +106,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
<version>3.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -143,7 +138,6 @@
<goals>
<goal>descriptor</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
Expand All @@ -162,7 +156,7 @@
<!-- mvn site -->
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version>0.9</version>
<version>0.10</version>
<configuration>
<message>Creating site for ${project.version}</message>
<noJekyll>true</noJekyll>
Expand All @@ -185,13 +179,13 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.2.3</version>
<version>3.2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.3</version>
<version>3.4</version>
<scope>provided</scope>
</dependency>
<!-- Compile -->
Expand All @@ -210,7 +204,7 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.4</version>
<version>2.3.1</version>
</dependency>
</dependencies>

Expand Down Expand Up @@ -240,45 +234,37 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<version>2.10.1</version>
<configuration>
<charset>${project.build.sourceEncoding}</charset>
<encoding>${project.build.sourceEncoding}</encoding>
<docencoding>${project.build.sourceEncoding}</docencoding>
<source>${maven.compiler.source}</source>
<linksource>true</linksource>
<quiet>true</quiet>
<links>
<link>http://docs.oracle.com/javaee/5/api/</link>
<link>http://docs.oracle.com/javase/7/docs/api/</link>
<link>http://docs.oracle.com/javaee/7/api/</link>
</links>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.4</version>
<configuration>
<inputEncoding>${project.build.sourceEncoding}</inputEncoding>
<outputEncoding>${project.build.sourceEncoding}</outputEncoding>
<javadocDir>target/site/apidocs</javadocDir>
</configuration>
<version>2.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>${maven.plugin.version}</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
</plugins>
</reporting>

<properties>
<github.global.server>github</github.global.server>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.plugin.version>3.3</maven.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<skipTests>true</skipTests>
<github.global.server>github</github.global.server>
<maven.plugin.version>3.4</maven.plugin.version>
</properties>
</project>
62 changes: 52 additions & 10 deletions src/main/java/com/samaxes/maven/minify/common/Aggregation.java
@@ -1,4 +1,9 @@
/*
* Minify Maven Plugin
* https://github.com/samaxes/minify-maven-plugin
*
* Copyright (c) 2009 samaxes.com
*
* Licensed 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
Expand All @@ -16,38 +21,75 @@
import java.util.Collections;
import java.util.List;

/**
* Maps a single bundle defined in {@link AggregationConfiguration}.
*/
public class Aggregation {

/**
* Defines the aggregation type.
*/
public enum AggregationType {
css, javascript;
css, js;
}

private AggregationType type;

private String name;
private List<String> files = Collections.emptyList();

private List<String> files = Collections.emptyList();

/**
* Gets the type.
*
* @return the type
*/
public AggregationType getType() {
return type;
}

/**
* Sets the type.
*
* @param type the type to set
*/
public void setType(AggregationType type) {
this.type = type;
}

public List<String> getFiles() {
return files;
}

public void setFiles(List<String> files) {
this.files = files;
}

/**
* Gets the name.
*
* @return the name
*/
public String getName() {
return name;
}

/**
* Sets the name.
*
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}

/**
* Gets the files.
*
* @return the files
*/
public List<String> getFiles() {
return files;
}

/**
* Sets the files.
*
* @param files the files to set
*/
public void setFiles(List<String> files) {
this.files = files;
}
}
@@ -1,4 +1,9 @@
/*
* Minify Maven Plugin
* https://github.com/samaxes/minify-maven-plugin
*
* Copyright (c) 2009 samaxes.com
*
* Licensed 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
Expand All @@ -15,17 +20,28 @@

import java.util.List;


/**
* Maps aggregations from an external JSON formatted config file defined in the option {@code bundleConfiguration}.
*/
public class AggregationConfiguration {

private List<Aggregation> bundles;

/**
* Gets the bundles.
*
* @return the bundles
*/
public List<Aggregation> getBundles() {
return bundles;
}

/**
* Sets the bundles.
*
* @param bundles the bundles to set
*/
public void setBundles(List<Aggregation> bundles) {
this.bundles = bundles;
}

}

0 comments on commit f5b814c

Please sign in to comment.