You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2012/05/30 00:33:26 UTC
svn commit: r1344035 - in
/myfaces/myfaces-build-tools/trunk/maven2-plugins/tobago-theme-plugin: ./
src/main/java/org/apache/myfaces/tobago/maven/plugin/
src/main/resources/META-INF/
Author: bommel
Date: Tue May 29 22:33:25 2012
New Revision: 1344035
URL: http://svn.apache.org/viewvc?rev=1344035&view=rev
Log:
(TOBAGO-1146)
Support for tobago-config.xml in theme plugin
Removed:
myfaces/myfaces-build-tools/trunk/maven2-plugins/tobago-theme-plugin/src/main/java/org/apache/myfaces/tobago/maven/plugin/PackThemeMojo.java
Modified:
myfaces/myfaces-build-tools/trunk/maven2-plugins/tobago-theme-plugin/ (props changed)
myfaces/myfaces-build-tools/trunk/maven2-plugins/tobago-theme-plugin/pom.xml
myfaces/myfaces-build-tools/trunk/maven2-plugins/tobago-theme-plugin/src/main/java/org/apache/myfaces/tobago/maven/plugin/UnPackThemeMojo.java
myfaces/myfaces-build-tools/trunk/maven2-plugins/tobago-theme-plugin/src/main/resources/META-INF/NOTICE.txt
Propchange: myfaces/myfaces-build-tools/trunk/maven2-plugins/tobago-theme-plugin/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue May 29 22:33:25 2012
@@ -5,3 +5,5 @@ target
.classpath
.project
.settings
+
+.idea
Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/tobago-theme-plugin/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/tobago-theme-plugin/pom.xml?rev=1344035&r1=1344034&r2=1344035&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/tobago-theme-plugin/pom.xml (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/tobago-theme-plugin/pom.xml Tue May 29 22:33:25 2012
@@ -18,10 +18,12 @@
<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>org.apache.myfaces.tobago</groupId>
- <artifactId>tobago</artifactId>
- <version>1.0.25</version>
+ <groupId>org.apache.myfaces</groupId>
+ <artifactId>myfaces</artifactId>
+ <version>14</version>
</parent>
+ <version>1.6.0-SNAPSHOT</version>
+ <groupId>org.apache.myfaces.tobago</groupId>
<artifactId>tobago-theme-plugin</artifactId>
<packaging>maven-plugin</packaging>
<name>Tobago Maven2 Theme Plugin</name>
@@ -60,6 +62,25 @@
</dependency>
</dependencies>
<build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>2.7</version>
+ <configuration>
+ <configLocation>
+ http://svn.apache.org/repos/asf/myfaces/maven/trunk/build-tools/src/main/resources/org/apache/myfaces/tobago/checkstyle.xml
+ </configLocation>
+ <headerLocation>
+ http://svn.apache.org/repos/asf/myfaces/maven/trunk/build-tools/src/main/resources/org/apache/myfaces/tobago/checkstyle-header.txt
+ </headerLocation>
+ <xrefLocation>xref</xrefLocation>
+ <excludes>**/package-info.java</excludes>
+ <indentSize>2</indentSize>
+ <includeTestSourceDirectory>true</includeTestSourceDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
<pluginManagement>
<plugins>
<plugin>
Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/tobago-theme-plugin/src/main/java/org/apache/myfaces/tobago/maven/plugin/UnPackThemeMojo.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/tobago-theme-plugin/src/main/java/org/apache/myfaces/tobago/maven/plugin/UnPackThemeMojo.java?rev=1344035&r1=1344034&r2=1344035&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/tobago-theme-plugin/src/main/java/org/apache/myfaces/tobago/maven/plugin/UnPackThemeMojo.java (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/tobago-theme-plugin/src/main/java/org/apache/myfaces/tobago/maven/plugin/UnPackThemeMojo.java Tue May 29 22:33:25 2012
@@ -17,7 +17,7 @@ package org.apache.myfaces.tobago.maven.
* limitations under the License.
*/
-import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DependencyResolutionRequiredException;
import org.apache.maven.plugin.MojoExecutionException;
import org.codehaus.plexus.archiver.ArchiverException;
import org.codehaus.plexus.archiver.UnArchiver;
@@ -29,7 +29,6 @@ import java.io.File;
import java.io.IOException;
import java.io.FileInputStream;
import java.util.Iterator;
-import java.util.List;
import java.util.Locale;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipEntry;
@@ -39,7 +38,7 @@ import java.util.zip.ZipEntry;
* @version $Id$
* @goal resources
* @phase process-resources
- * @requiresDependencyResolution compile
+ * @requiresDependencyResolution runtime
*/
public class UnPackThemeMojo extends AbstractThemeMojo {
/**
@@ -66,11 +65,6 @@ public class UnPackThemeMojo extends Abs
*/
private File webappDirectory;
- /**
- * @parameter expression="${plugin.artifacts}"
- * @required
- */
- private List pluginArtifacts;
private boolean findThemeDescriptor(File jarFile) throws MojoExecutionException {
ZipInputStream zip = null;
@@ -82,7 +76,7 @@ public class UnPackThemeMojo extends Abs
continue;
}
String name = nextEntry.getName();
- if (name.equals("META-INF/tobago-theme.xml")) {
+ if (name.equals("META-INF/tobago-theme.xml")|| name.equals("META-INF/tobago-config.xml")) {
return true;
}
}
@@ -102,47 +96,51 @@ public class UnPackThemeMojo extends Abs
}
public void execute() throws MojoExecutionException {
-
- Iterator artifacts = getProject().getDependencyArtifacts().iterator();
- while (artifacts.hasNext()) {
+ try {
+ Iterator artifacts = getProject().getRuntimeClasspathElements().iterator();
if (!workDirectory.exists()) {
workDirectory.mkdirs();
}
- Artifact artifact = (Artifact) artifacts.next();
- getLog().debug("Expanding theme "+ artifact);
- File file = artifact.getFile();
- if (Artifact.SCOPE_COMPILE.equals(artifact.getScope()) && file.isFile()
- && "jar".equals(artifact.getType()) && findThemeDescriptor(file)) {
-
- String name = file.getName();
- getLog().debug("Expanding theme "+ name);
- File tempLocation = new File(workDirectory, name.substring(0, name.length() - 4));
- boolean process = false;
- if (!tempLocation.exists()) {
- tempLocation.mkdirs();
- process = true;
- } else if (artifact.getFile().lastModified() > tempLocation.lastModified()) {
- process = true;
- }
- if (process) {
- try {
- unpack(file, tempLocation);
- String[] fileNames = getThemeFiles(tempLocation);
- for (String fileName : fileNames) {
-
- File fromFile = new File(tempLocation, fileName);
- File toFile = new File(webappDirectory, fileName);
- try {
- FileUtils.copyFile(fromFile, toFile);
- } catch (IOException e) {
- throw new MojoExecutionException("Error copy file: " + fromFile + "to: " + toFile, e);
+ while (artifacts.hasNext()) {
+
+ String artifact = (String) artifacts.next();
+ getLog().debug("Testing jar "+ artifact);
+
+ File file = new File(artifact);
+ if (file.isFile() && artifact.endsWith(".jar") && findThemeDescriptor(file)) {
+ String name = file.getName();
+ File tempLocation = new File(workDirectory, name.substring(0, name.length() - 4));
+ boolean process = false;
+ if (!tempLocation.exists()) {
+ tempLocation.mkdirs();
+ process = true;
+ } else if (file.lastModified() > tempLocation.lastModified()) {
+ process = true;
+ }
+ if (process) {
+ getLog().debug("Expanding theme "+ name);
+ try {
+ unpack(file, tempLocation);
+ String[] fileNames = getThemeFiles(tempLocation);
+ for (int i = 0, fileNamesLength = fileNames.length; i < fileNamesLength; i++) {
+ String fileName = fileNames[i];
+
+ File fromFile = new File(tempLocation, fileName);
+ File toFile = new File(webappDirectory, fileName);
+ try {
+ FileUtils.copyFile(fromFile, toFile);
+ } catch (IOException e) {
+ throw new MojoExecutionException("Error copy file: " + fromFile + "to: " + toFile, e);
+ }
}
+ } catch (NoSuchArchiverException e) {
+ getLog().info("Skip unpacking dependency file with unknown extension: " + file.getPath());
}
- } catch (NoSuchArchiverException e) {
- getLog().info("Skip unpacking dependency file with unknown extension: " + file.getPath());
}
}
}
+ } catch (DependencyResolutionRequiredException drre) {
+ throw new MojoExecutionException(drre.getMessage(), drre);
}
}
Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/tobago-theme-plugin/src/main/resources/META-INF/NOTICE.txt
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/tobago-theme-plugin/src/main/resources/META-INF/NOTICE.txt?rev=1344035&r1=1344034&r2=1344035&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/tobago-theme-plugin/src/main/resources/META-INF/NOTICE.txt (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/tobago-theme-plugin/src/main/resources/META-INF/NOTICE.txt Tue May 29 22:33:25 2012
@@ -1,5 +1,5 @@
Apache Tobago
-Copyright 2005-2010 The Apache Software Foundation
+Copyright 2005-2012 The Apache Software Foundation
This product includes software developed by
The Apache Software Foundation (http://www.apache.org/).