You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by at...@apache.org on 2007/05/01 00:12:21 UTC
svn commit: r533866 -
/portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/
Author: ate
Date: Mon Apr 30 15:12:20 2007
New Revision: 533866
URL: http://svn.apache.org/viewvc?view=rev&rev=533866
Log:
- refactored the way unpack resources can be configured, now using native PlexusConfiguration to allow xml attribute usages which makes it much, much cleaner
- now ant like pattern matching (includes,excludes etc.) are supported
Added:
portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/Resources.java (with props)
Removed:
portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/UnpackResource.java
Modified:
portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/DDLGeneratorMojo.java
portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/InitDbMojo.java
portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/ResourceBundleUnpacker.java
portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/UnpackResources.java
portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/UnpackResourcesMojo.java
Modified: portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/DDLGeneratorMojo.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/DDLGeneratorMojo.java?view=diff&rev=533866&r1=533865&r2=533866
==============================================================================
--- portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/DDLGeneratorMojo.java (original)
+++ portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/DDLGeneratorMojo.java Mon Apr 30 15:12:20 2007
@@ -142,8 +142,7 @@
// hack to map LONGVARCHAR to VARCHAR2(4000) on Oracle, the predefined CLOB type really isn't usable
platform.getPlatformInfo().addNativeTypeMapping("LONGVARCHAR", "VARCHAR2(4000)");
}
- boolean isCaseSensitive = platform.isDelimitedIdentifierModeOn();
- CreationParameters params = getFilteredParameters(model, platform.getName(), isCaseSensitive);
+ CreationParameters params = getFilteredParameters(model, platform.getName(), useDelimitedSqlIdentifiers);
try
{
StringWriter stringWriter = new StringWriter();
Modified: portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/InitDbMojo.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/InitDbMojo.java?view=diff&rev=533866&r1=533865&r2=533866
==============================================================================
--- portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/InitDbMojo.java (original)
+++ portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/InitDbMojo.java Mon Apr 30 15:12:20 2007
@@ -40,6 +40,7 @@
import org.apache.maven.settings.Server;
import org.apache.maven.settings.Settings;
import org.apache.maven.shared.downloader.Downloader;
+import org.codehaus.plexus.configuration.PlexusConfiguration;
/**
* @version $Id$
@@ -177,18 +178,45 @@
{
if ( skip )
{
- this.getLog().info( "Skipping initDb" );
+ this.getLog().info( "Skipping init-db" );
return;
}
if ( unpackResources != null && !isEmpty(unpackResources.getResourceBundle()) )
{
+ Resources[] resources = null;
+ if ( unpackResources.getResources() == null )
+ {
+ // extract all to targetBaseDirectory
+ resources = new Resources[1];
+ resources[0] = new Resources();
+ }
+ else
+ {
+ PlexusConfiguration[] configs = unpackResources.getResources().getChildren("unpack");
+ if ( configs.length == 0 )
+ {
+ throw new MojoExecutionException("No unpack definitions specified");
+ }
+ resources = new Resources[configs.length];
+ try
+ {
+ for ( int i = 0; i < configs.length; i++ )
+ {
+ resources[i] = new Resources(configs[i]);
+ }
+ }
+ catch (Exception e)
+ {
+ throw new MojoExecutionException("Failed to parse the unpackResources resources configuration(s)",e);
+ }
+ }
File file = ResourceBundleUnpacker.getRemoteResourceBundle(unpackResources.getResourceBundle(), downloader, localRepository, remoteRepositories, artifactRepositoryFactory, mavenSession);
if ( isEmpty(unpackResources.getTargetBaseDirectory()) )
{
unpackResources.setTargetBaseDirectory(project.getBuild().getDirectory());
}
- ResourceBundleUnpacker.unpackResources(file, unpackResources.getTargetBaseDirectory(), unpackResources.getResources(), unpackResources.isOverwrite(), getLog());
+ ResourceBundleUnpacker.unpackResources(file, unpackResources.getTargetBaseDirectory(), resources, getLog());
}
if ( (sqlScripts != null && sqlScripts.length > 0) || seedConfig != null )
@@ -198,7 +226,7 @@
// validate connection configuration early
Connection connection = getConnection();
- System.out.println("Running initDb against "+url+" for user "+username);
+ getLog().info("Running init-db against "+url+" for user "+username);
if ( sqlScripts != null )
{
@@ -397,7 +425,6 @@
StringBuffer line = new StringBuffer();
line.append( updateCountTotal ).append( " rows affected" );
- System.out.println( line );
}
SQLWarning warning = connection.getWarnings();
Modified: portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/ResourceBundleUnpacker.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/ResourceBundleUnpacker.java?view=diff&rev=533866&r1=533865&r2=533866
==============================================================================
--- portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/ResourceBundleUnpacker.java (original)
+++ portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/ResourceBundleUnpacker.java Mon Apr 30 15:12:20 2007
@@ -76,7 +76,7 @@
}
}
- public static void unpackResources(File resourceBundleFile, String targetBaseDirectory, UnpackResource[] resources, boolean overwrite, Log log) throws MojoExecutionException
+ public static void unpackResources(File resourceBundleFile, String targetBaseDirectory, Resources[] resources, Log log) throws MojoExecutionException
{
File targetBaseDir = new File(targetBaseDirectory);
if ( targetBaseDir.exists())
@@ -88,25 +88,6 @@
{
targetBaseDir.mkdirs();
}
-
- UnpackResource[] targetResources = (UnpackResource[])resources.clone();
- for ( int i = 0; i < targetResources.length; i++ )
- {
- resources[i].resolvePaths(i);
- targetResources[i].setToDir(targetBaseDir.getAbsolutePath()+targetResources[i].getToDir());
- File toDir = new File(targetResources[i].getToDir());
- if (toDir.exists())
- {
- if (!toDir.isDirectory())
- {
- throw new MojoExecutionException("Invalid resources["+i+"] toDir "+toDir.getAbsolutePath()+": not a directory");
- }
- }
- else
- {
- toDir.mkdirs();
- }
- }
ZipInputStream zis = null;
try
{
@@ -119,25 +100,17 @@
{
for ( int i = 0; i < resources.length; i++ )
{
- UnpackResource ur = resources[i];
- if ( (!isEmpty(ur.getFromFile()) && ze.getName().equals(ur.getFromFile())) || (isEmpty(ur.getFromFile()) && ze.getName().startsWith(ur.getFromDir())) )
+ String destFileName = resources[i].getDestFileName(ze.getName(), targetBaseDirectory);
+ if ( destFileName != null )
{
- File destFile = null;
- if ( !isEmpty(ur.getToFile()) )
- {
- destFile = new File(ur.getToDir()+ur.getToFile());
- }
- else
- {
- destFile = new File(ur.getToDir()+ze.getName().substring(ur.getFromDir().length()));
- }
+ File destFile = new File(destFileName);
if ( destFile.exists() )
{
if (!destFile.isFile() )
{
throw new MojoExecutionException("Destination "+destFile.getAbsolutePath()+" already exists and is not a file");
}
- if ( destFile.lastModified() >= ze.getTime() || !overwrite )
+ if ( destFile.lastModified() >= ze.getTime() || !resources[i].isOverwrite() )
{
log.info(ze.getName()+" skipped: already exists at "+destFile.getAbsolutePath());
continue;
@@ -200,10 +173,5 @@
}
}
}
- }
-
- private static boolean isEmpty(String value)
- {
- return value == null || value.length() == 0;
}
}
Added: portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/Resources.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/Resources.java?view=auto&rev=533866
==============================================================================
--- portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/Resources.java (added)
+++ portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/Resources.java Mon Apr 30 15:12:20 2007
@@ -0,0 +1,330 @@
+/*
+ * 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 regarding copyright ownership.
+ * The ASF licenses this file to You 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.maven.plugins;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.codehaus.plexus.configuration.PlexusConfiguration;
+import org.codehaus.plexus.configuration.PlexusConfigurationException;
+import org.codehaus.plexus.util.SelectorUtils;
+
+/**
+ * @version $Id$
+ *
+ */
+public class Resources
+{
+ public static class EntrySet
+ {
+ private String dir;
+
+ private String[] includes;
+
+ private String[] excludes;
+
+ public EntrySet(String dir)
+ {
+ this.dir = makeRelativePath(dir);
+ }
+
+ /**
+ * Sets the list of exclude patterns to use. All '/' and '\' characters
+ * are replaced by <code>File.separatorChar</code>, so the separator
+ * used need not match <code>File.separatorChar</code>.
+ * <p>
+ * When a pattern ends with a '/' or '\', "**" is appended.
+ *
+ * @param excludes
+ * A list of exclude patterns. May be <code>null</code>,
+ * indicating that no files should be excluded. If a non-<code>null</code>
+ * list is given, all elements must be non-<code>null</code>.
+ */
+ public void setExcludes(String[] excludes)
+ {
+ if (excludes == null || excludes.length == 0)
+ {
+ this.excludes = null;
+ }
+ else
+ {
+ this.excludes = new String[excludes.length];
+ for (int i = 0; i < excludes.length; i++)
+ {
+ String pattern;
+ pattern = fixFileSeparator(excludes[i]);
+ if (pattern.endsWith(File.separator))
+ {
+ pattern += "**";
+ }
+ pattern = makeRelativePath(pattern);
+ if ( dir.length() > 0)
+ {
+ pattern = dir + File.separatorChar + pattern;
+ }
+ this.excludes[i] = pattern;
+ }
+ }
+ }
+
+ /**
+ * Sets the list of include patterns to use. All '/' and '\' characters
+ * are replaced by <code>File.separatorChar</code>, so the separator
+ * used need not match <code>File.separatorChar</code>.
+ * <p>
+ * When a pattern ends with a '/' or '\', "**" is appended.
+ *
+ * @param includes
+ * A list of include patterns. May be <code>null</code>,
+ * indicating that all files should be included. If a non-<code>null</code>
+ * list is given, all elements must be non-<code>null</code>.
+ */
+ public void setIncludes(String[] includes)
+ {
+ if (includes == null || includes.length == 0)
+ {
+ this.includes = new String[1];
+ if ( dir.length() > 0 )
+ {
+ this.includes[0] = dir + File.separator + "**";
+ }
+ else
+ {
+ this.includes[0] = "**";
+ }
+ }
+ else
+ {
+ this.includes = new String[includes.length];
+ for (int i = 0; i < includes.length; i++)
+ {
+ String pattern;
+ pattern = fixFileSeparator(includes[i]);
+ if (pattern.endsWith(File.separator))
+ {
+ pattern += "**";
+ }
+ pattern = makeRelativePath(pattern);
+ if ( dir.length() > 0)
+ {
+ pattern = dir + File.separatorChar + pattern;
+ }
+ this.includes[i] = pattern;
+ }
+ }
+ }
+
+ public String getDir()
+ {
+ return dir;
+ }
+
+ public String[] getExcludes()
+ {
+ return excludes;
+ }
+
+ public String[] getIncludes()
+ {
+ return includes;
+ }
+ }
+
+ private String dest;
+
+ private boolean flat;
+
+ private boolean overwrite = true;
+
+ public EntrySet[] entries;
+
+ public Resources()
+ {
+ dest = "";
+ entries = new EntrySet[1];
+ entries[0] = new EntrySet("");
+ entries[0].setIncludes(null);
+ }
+
+ public Resources(PlexusConfiguration config) throws PlexusConfigurationException
+ {
+ EntrySet entrySet;
+ List includes = new ArrayList();
+ List excludes = new ArrayList();
+ List entries;
+
+ dest = makeRelativePath(config.getAttribute("dest"));
+ overwrite = Boolean.valueOf(config.getAttribute("overwrite", "true")).booleanValue();
+ flat = Boolean.valueOf(config.getAttribute("flat", "false")).booleanValue();
+
+ if (config.getAttribute("dir") != null || config.getAttribute("includes") != null || config.getAttribute("excludes") != null )
+ {
+ entrySet = new EntrySet(config.getAttribute("dir"));
+ addPatterns(config.getAttribute("includes"), includes);
+ addPatterns(config.getAttribute("excludes"), excludes);
+ entrySet.setIncludes((String[]) includes.toArray(new String[includes.size()]));
+ entrySet.setExcludes((String[]) excludes.toArray(new String[excludes.size()]));
+ this.entries = new EntrySet[1];
+ this.entries[0] = entrySet;
+ }
+ else
+ {
+ entries = new ArrayList();
+ PlexusConfiguration[] children = config.getChildren("entryset");
+ for (int i = 0; i < children.length; i++)
+ {
+ includes.clear();
+ excludes.clear();
+ entrySet = new EntrySet(children[i].getAttribute("dir"));
+ addPatterns(children[i].getAttribute("includes"), includes);
+ addPatterns(children[i].getAttribute("excludes"), excludes);
+ addChildPatterns(children[i].getChildren("include"), includes);
+ addChildPatterns(children[i].getChildren("exclude"), excludes);
+ entrySet.setIncludes((String[]) includes.toArray(new String[includes.size()]));
+ entrySet.setExcludes((String[]) excludes.toArray(new String[excludes.size()]));
+
+ entries.add(entrySet);
+ }
+ this.entries = (EntrySet[])entries.toArray(new EntrySet[entries.size()]);
+ }
+ }
+
+ public boolean isOverwrite()
+ {
+ return overwrite;
+ }
+
+ private static void addPatterns(String patternList, List list)
+ {
+ if (patternList != null)
+ {
+ StringTokenizer t = new StringTokenizer(patternList, ", ");
+ while (t.hasMoreTokens())
+ {
+ list.add(t.nextToken());
+ }
+ }
+ }
+
+ private static void addChildPatterns(PlexusConfiguration[] children, List list) throws PlexusConfigurationException
+ {
+ for (int i = 0; i < children.length; i++)
+ {
+ String attr = children[i].getAttribute("name");
+ if (attr != null)
+ {
+ list.add(attr);
+ }
+ }
+ }
+
+ private static String fixFileSeparator(String name)
+ {
+ return name != null ? name.trim().replace('/', File.separatorChar).replace('\\', File.separatorChar) : null;
+ }
+
+ private static String makeRelativePath(String dir)
+ {
+ if ( dir != null )
+ {
+ dir = fixFileSeparator(dir);
+ while (dir.startsWith(File.separator))
+ {
+ dir = dir.substring(File.separator.length());
+ }
+ while (dir.endsWith(File.separator))
+ {
+ dir = dir.substring(0,dir.length()-File.separator.length());
+ }
+ }
+ else
+ {
+ dir = "";
+ }
+ return dir;
+ }
+
+ public String getDestFileName(String entryName, String baseDirectory)
+ {
+ String destFileName = null;
+ if ( entryName != null )
+ {
+ boolean match = false;
+ entryName = makeRelativePath(entryName);
+ for ( int i = 0; i < entries.length; i++ )
+ {
+ EntrySet entrySet = entries[i];
+ if ( entrySet.includes != null )
+ {
+ for ( int j = 0; j < entrySet.includes.length; j++ )
+ {
+ if ( SelectorUtils.matchPath(entrySet.includes[j], entryName ) )
+ {
+ match = true;
+ break;
+ }
+ }
+ }
+ else
+ {
+ match = true;
+ }
+ if ( match == true && entries[i].excludes != null )
+ {
+ for ( int j = 0; j < entrySet.excludes.length; j++ )
+ if ( SelectorUtils.matchPath(entrySet.excludes[j], entryName ) )
+ {
+ match = false;
+ break;
+ }
+ }
+ if ( match )
+ {
+ if ( entrySet.getDir().length() > 0 )
+ {
+ entryName = entryName.substring(entrySet.getDir().length()+File.separator.length());
+ }
+ if ( flat )
+ {
+ int index = entryName.lastIndexOf( File.separator );
+ entryName = ( index >= 0 ? entryName.substring( index + 1 ) : entryName );
+ }
+ if ( baseDirectory == null )
+ {
+ baseDirectory = "";
+ }
+ else if (!baseDirectory.endsWith(File.separator))
+ {
+ baseDirectory += File.separator;
+ }
+ if (dest.length() > 0 )
+ {
+ destFileName = baseDirectory + File.separator + dest + File.separator + entryName;
+ }
+ else
+ {
+ destFileName = baseDirectory + entryName;
+ }
+ break;
+ }
+ }
+ }
+ return destFileName;
+ }
+}
Propchange: portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/Resources.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/Resources.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/UnpackResources.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/UnpackResources.java?view=diff&rev=533866&r1=533865&r2=533866
==============================================================================
--- portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/UnpackResources.java (original)
+++ portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/UnpackResources.java Mon Apr 30 15:12:20 2007
@@ -16,6 +16,8 @@
*/
package org.apache.jetspeed.maven.plugins;
+import org.codehaus.plexus.configuration.PlexusConfiguration;
+
/**
* @version $Id$
*
@@ -24,7 +26,7 @@
{
private String resourceBundle;
private String targetBaseDirectory;
- private UnpackResource[] resources;
+ private PlexusConfiguration resources;
private boolean overwrite;
public String getResourceBundle()
@@ -35,11 +37,11 @@
{
this.resourceBundle = resourceBundle;
}
- public UnpackResource[] getResources()
+ public PlexusConfiguration getResources()
{
return resources;
}
- public void setResources(UnpackResource[] resources)
+ public void setResources(PlexusConfiguration resources)
{
this.resources = resources;
}
Modified: portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/UnpackResourcesMojo.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/UnpackResourcesMojo.java?view=diff&rev=533866&r1=533865&r2=533866
==============================================================================
--- portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/UnpackResourcesMojo.java (original)
+++ portals/jetspeed-2/branches/J2-M2-REDUX/maven/jetspeed-maven-plugins/src/main/java/org/apache/jetspeed/maven/plugins/UnpackResourcesMojo.java Mon Apr 30 15:12:20 2007
@@ -27,6 +27,7 @@
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.project.MavenProject;
import org.apache.maven.shared.downloader.Downloader;
+import org.codehaus.plexus.configuration.PlexusConfiguration;
/**
* UnpackResourcesMojo provides extracting specific folders within a (remote) resource bundle jar to specific output folders.
@@ -51,17 +52,15 @@
private String targetBaseDirectory;
/**
- * Should existing files be overwritten if older than the resoure file.
- * Existing files newer than the resource file are never overwritten.
+ * When true, skip the execution.
* @parameter default-value="false"
*/
- private boolean overwrite;
+ private boolean skip;
/**
* @parameter
- * @required
*/
- private UnpackResource[] resources;
+ private PlexusConfiguration resources;
/**
* The local repository taken from Maven's runtime. Typically $HOME/.m2/repository.
@@ -116,11 +115,45 @@
*/
public void execute() throws MojoExecutionException, MojoFailureException
{
+ if ( skip )
+ {
+ this.getLog().info( "Skipping unpack-resources" );
+ return;
+ }
+
+ Resources[] unpackResources = null;
+
+ if ( resources == null )
+ {
+ // extract all to targetBaseDirectory
+ unpackResources = new Resources[1];
+ unpackResources[0] = new Resources();
+ }
+ else
+ {
+ PlexusConfiguration[] configs = resources.getChildren("unpack");
+ if ( configs.length == 0 )
+ {
+ throw new MojoExecutionException("No unpack definitions specified");
+ }
+ unpackResources = new Resources[configs.length];
+ try
+ {
+ for ( int i = 0; i < configs.length; i++ )
+ {
+ unpackResources[i] = new Resources(configs[i]);
+ }
+ }
+ catch (Exception e)
+ {
+ throw new MojoExecutionException("Failed to parse the resources configuration(s)",e);
+ }
+ }
if ( targetBaseDirectory == null || targetBaseDirectory.length() == 0 )
{
targetBaseDirectory = project.getBuild().getDirectory();
}
File file = ResourceBundleUnpacker.getRemoteResourceBundle(resourceBundle, downloader, localRepository, remoteRepositories, artifactRepositoryFactory, mavenSession);
- ResourceBundleUnpacker.unpackResources(file, targetBaseDirectory, resources, overwrite, getLog());
+ ResourceBundleUnpacker.unpackResources(file, targetBaseDirectory, unpackResources, getLog());
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org