improve scm-web-compressor maven-plugin

This commit is contained in:
Sebastian Sdorra
2010-11-21 19:21:52 +01:00
parent 8283e31114
commit 51e1ac109d
7 changed files with 109 additions and 8 deletions

View File

@@ -11,12 +11,18 @@
<groupId>sonia.scm.maven</groupId>
<artifactId>scm-web-compressor</artifactId>
<packaging>jar</packaging>
<packaging>maven-plugin</packaging>
<version>1.0-M2-SNAPSHOT</version>
<name>scm-web-compressor</name>
<dependencies>
<dependency>
<groupId>sonia.scm</groupId>
<artifactId>scm-core</artifactId>
<version>1.0-M2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
@@ -37,10 +43,9 @@
<dependency>
<groupId>com.google.closure</groupId>
<artifactId>compiler</artifactId>
<artifactId>repacked-compiler</artifactId>
<version>20100917</version>
<scope>system</scope>
<systemPath>${basedir}/lib/compiler-20100917.jar</systemPath>
<classifier>full</classifier>
</dependency>
</dependencies>

View File

@@ -55,7 +55,7 @@ import java.util.LinkedHashSet;
import java.util.Set;
/**
*
* @goal compress
* @author Sebastian Sdorra
*/
public class WebCompressorMojo extends AbstractMojo
@@ -68,8 +68,8 @@ public class WebCompressorMojo extends AbstractMojo
public WebCompressorMojo()
{
compressorSet = new LinkedHashSet<WebCompressor>();
compressorSet.add(new ClosureWebCompressor());
compressorSet.add(new YuiWebCompressor());
compressorSet.add(new ClosureWebCompressor());
}
//~--- methods --------------------------------------------------------------
@@ -84,6 +84,8 @@ public class WebCompressorMojo extends AbstractMojo
@Override
public void execute() throws MojoExecutionException, MojoFailureException
{
IOUtil.mkdirs(outputDirectory);
OutputStream output = null;
try
@@ -97,6 +99,7 @@ public class WebCompressorMojo extends AbstractMojo
encoding, outputPrefix, concat);
}
IOUtil.mkdirs(outputFile.getParentFile());
output = new FileOutputStream(outputFile);
output.write(document.html().getBytes(encoding));
}

View File

@@ -75,8 +75,8 @@ public class YuiWebCompressor extends AbstractWebCompressor
@Override
protected void appendElement(Document document, String path)
{
document.appendElement("link").attr("type", "text/css").attr("rel",
"stylesheet").attr("href", path);
document.head().appendElement("link").attr("type", "text/css").attr("rel",
"stylesheet").attr("href", path);
}
/**

55
third-party/closure-compiler/pom.xml vendored Normal file
View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>sonia.scm.third-party</groupId>
<artifactId>sonia.scm.third-party</artifactId>
<version>1.0-M2-SNAPSHOT</version>
</parent>
<groupId>com.google.closure</groupId>
<artifactId>repacked-compiler</artifactId>
<packaging>pom</packaging>
<version>20100917</version>
<name>repacked-compiler</name>
<dependencies>
<dependency>
<groupId>com.google.closure</groupId>
<artifactId>compiler</artifactId>
<version>20100917</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/compiler-20100917.jar</systemPath>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>attached</goal>
</goals>
</execution>
</executions>
<configuration>
<descriptors>
<descriptor>src/main/assembly/compiler.xml</descriptor>
</descriptors>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Document : descriptor.xml
Created on : November 21, 2010, 7:04 PM
Author : sdorra
Description:
Purpose of the document follows.
-->
<assembly xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns='http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.1'
xsi:schemaLocation='http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.1 http://maven.apache.org/xsd/assembly-1.1.1.xsd'>
<id>full</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<unpack>true</unpack>
<scope>system</scope>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>target/classes</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
</assembly>

1
third-party/pom.xml vendored
View File

@@ -17,6 +17,7 @@
<modules>
<module>svnkit-dav</module>
<module>closure-compiler</module>
</modules>
</project>