From 5a44f5c49f5a779b58ea6f8dfef4ca67e62d1004 Mon Sep 17 00:00:00 2001 From: Michael Klein Date: Wed, 16 Jul 2014 10:00:05 +0200 Subject: [PATCH 1/2] Updated to work with Maven 3 --- pom.xml | 88 ++++++++++++------- .../murphybob/spritepacker/Spritepacker.java | 42 ++++----- 2 files changed, 75 insertions(+), 55 deletions(-) diff --git a/pom.xml b/pom.xml index e223d5f..81752ad 100644 --- a/pom.xml +++ b/pom.xml @@ -1,42 +1,68 @@ - 4.0.0 - com.murphybob - spritepacker-maven-plugin - 0.9.0 - maven-plugin - - src - - - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - - - - org.codehaus.jackson - jackson-mapper-asl - 1.9.11 - - - org.apache.maven - maven-plugin-api - 2.0 - + 4.0.0 + com.murphybob + spritepacker-maven-plugin + 0.10.0 + maven-plugin + spritepacker-maven-plugin Maven Mojo + + 3.0.0 + + + src + + + maven-compiler-plugin + 3.1 + + 1.6 + 1.6 + + + + org.apache.maven.plugins + maven-plugin-plugin + 3.2 + + + default-descriptor + + descriptor + + process-classes + + + + + + + + + org.apache.maven + maven-plugin-api + 3.0 + + + org.apache.maven.plugin-tools + maven-plugin-annotations + 3.2 + provided + + + + org.codehaus.jackson + jackson-mapper-asl + 1.9.12 + org.codehaus.plexus plexus-utils - 3.0 + 3.0.17 org.sonatype.plexus plexus-build-api 0.0.7 - + \ No newline at end of file diff --git a/src/com/murphybob/spritepacker/Spritepacker.java b/src/com/murphybob/spritepacker/Spritepacker.java index 94cb861..d08fec2 100644 --- a/src/com/murphybob/spritepacker/Spritepacker.java +++ b/src/com/murphybob/spritepacker/Spritepacker.java @@ -20,33 +20,33 @@ import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; /** * Packs spritesheets from supplied images. * * @author Robert Murphy - * @goal compile - * @phase process-sources */ +@Mojo( name = "compile", defaultPhase = LifecyclePhase.PROCESS_SOURCES ) public class Spritepacker extends AbstractMojo { private static long startTime = System.currentTimeMillis(); /** * Output spritesheet image name - * - * @parameter expression="${spritepacker.output}" - * @required */ - private static File output; + @Parameter( required = true ) + private File output; /** * Output json(p) description file containing coords and dimensions. - * - * @parameter expression="${spritepacker.json}" */ - private static File json; + @Parameter + private File json; /** * Optional padding variable for jsonp files @@ -54,41 +54,35 @@ public class Spritepacker extends AbstractMojo { * { image: {...} } * becomes * jsonpVar = { image: {...} } - * - * @parameter expression="${spritepacker.jsonpVar}" */ - private static String jsonpVar; + @Parameter + private String jsonpVar; /** * The source directory containing the LESS sources. - * - * @parameter expression="${spritepacker.sourceDirectory}" - * @required */ + @Parameter( required = true ) private File sourceDirectory; /** * List of files to include. Specified as fileset patterns which are relative to the source directory. Default is all files. - * - * @parameter */ + @Parameter private String[] includes = new String[]{ "**/*" }; /** * List of files to exclude. Specified as fileset patterns which are relative to the source directory. - * - * @parameter */ + @Parameter private String[] excludes = new String[] {}; /** * Optional transparent padding added between images in spritesheet. - * - * @parameter expression="${spritepacker.padding}" default-value="0" */ - private static Integer padding; + @Parameter( defaultValue = "0" ) + private Integer padding; - /** @component */ + @Component private BuildContext buildContext; /** @@ -197,7 +191,7 @@ public int compare(ImageNode arg0, ImageNode arg1) { int max1 = Math.max(arg1.image.getWidth(), arg1.image.getHeight()); return max1 - max0; } - }); + }); } private Node packImages( ArrayList images, Integer padding ){ From b0c2149c232bb4f3fd48364aaa7d75e010eb1f08 Mon Sep 17 00:00:00 2001 From: Michael Klein Date: Wed, 16 Jul 2014 10:12:19 +0200 Subject: [PATCH 2/2] Updated readme --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 1b6c517..0a7f431 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Include the plugin in your maven project, and use the pom.xml configuration dire com.murphybob spritepacker-maven-plugin - 0.9 + 0.10.0 ${project.basedir}/src/images/sprites/ @@ -25,14 +25,14 @@ Include the plugin in your maven project, and use the pom.xml configuration dire ${project.build.directory}/images/assets-sprite.png ${project.build.directory}/images/assets-sprite.json 10 - - - - compile - - - + + + + compile + + + Configuration