You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2008/03/24 14:18:01 UTC
svn commit: r640405 [3/4] - in /maven/plugins/trunk/maven-shade-plugin: ./
src/main/java/org/apache/maven/plugins/shade/
src/main/java/org/apache/maven/plugins/shade/filter/
src/main/java/org/apache/maven/plugins/shade/mojo/
src/main/java/org/apache/ma...
Propchange: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/pom/PomWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/pom/PomWriter.java?rev=640405&r1=640404&r2=640405&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/pom/PomWriter.java (original)
+++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/pom/PomWriter.java Mon Mar 24 06:17:58 2008
@@ -1,77 +1,77 @@
-package org.apache.maven.plugins.shade.pom;
-
-/*
- * 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.
- */
-
-import java.io.IOException;
-import java.io.Writer;
-
-import org.apache.maven.model.Model;
-import org.jdom.Document;
-import org.jdom.Element;
-import org.jdom.Namespace;
-import org.jdom.output.Format;
-
-/** @author Jason van Zyl */
-public class PomWriter
-{
- public static void write( Writer w,
- Model newModel )
- throws IOException
- {
- write( w, newModel, false );
- }
-
- public static void write( Writer w,
- Model newModel,
- boolean namespaceDeclaration )
- throws IOException
- {
- Element root = new Element( "project" );
-
- if ( namespaceDeclaration )
- {
- String modelVersion = newModel.getModelVersion();
-
- Namespace pomNamespace = Namespace.getNamespace( "", "http://maven.apache.org/POM/" + modelVersion );
-
- root.setNamespace( pomNamespace );
-
- Namespace xsiNamespace = Namespace.getNamespace( "xsi", "http://www.w3.org/2001/XMLSchema-instance" );
-
- root.addNamespaceDeclaration( xsiNamespace );
-
- if ( root.getAttribute( "schemaLocation", xsiNamespace ) == null )
- {
- root.setAttribute( "schemaLocation", "http://maven.apache.org/POM/" + modelVersion +
- " http://maven.apache.org/maven-v" + modelVersion.replace( '.', '_' ) + ".xsd", xsiNamespace );
- }
- }
-
- Document doc = new Document( root );
-
- MavenJDOMWriter writer = new MavenJDOMWriter();
-
- String encoding = newModel.getModelEncoding() != null ? newModel.getModelEncoding() : "UTF-8";
-
- Format format = Format.getPrettyFormat().setEncoding( encoding );
-
- writer.write( newModel, doc, w, format );
- }
-}
+package org.apache.maven.plugins.shade.pom;
+
+/*
+ * 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.
+ */
+
+import java.io.IOException;
+import java.io.Writer;
+
+import org.apache.maven.model.Model;
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.Namespace;
+import org.jdom.output.Format;
+
+/** @author Jason van Zyl */
+public class PomWriter
+{
+ public static void write( Writer w,
+ Model newModel )
+ throws IOException
+ {
+ write( w, newModel, false );
+ }
+
+ public static void write( Writer w,
+ Model newModel,
+ boolean namespaceDeclaration )
+ throws IOException
+ {
+ Element root = new Element( "project" );
+
+ if ( namespaceDeclaration )
+ {
+ String modelVersion = newModel.getModelVersion();
+
+ Namespace pomNamespace = Namespace.getNamespace( "", "http://maven.apache.org/POM/" + modelVersion );
+
+ root.setNamespace( pomNamespace );
+
+ Namespace xsiNamespace = Namespace.getNamespace( "xsi", "http://www.w3.org/2001/XMLSchema-instance" );
+
+ root.addNamespaceDeclaration( xsiNamespace );
+
+ if ( root.getAttribute( "schemaLocation", xsiNamespace ) == null )
+ {
+ root.setAttribute( "schemaLocation", "http://maven.apache.org/POM/" + modelVersion +
+ " http://maven.apache.org/maven-v" + modelVersion.replace( '.', '_' ) + ".xsd", xsiNamespace );
+ }
+ }
+
+ Document doc = new Document( root );
+
+ MavenJDOMWriter writer = new MavenJDOMWriter();
+
+ String encoding = newModel.getModelEncoding() != null ? newModel.getModelEncoding() : "UTF-8";
+
+ Format format = Format.getPrettyFormat().setEncoding( encoding );
+
+ writer.write( newModel, doc, w, format );
+ }
+}
Propchange: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/pom/PomWriter.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/relocation/Relocator.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/relocation/Relocator.java?rev=640405&r1=640404&r2=640405&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/relocation/Relocator.java (original)
+++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/relocation/Relocator.java Mon Mar 24 06:17:58 2008
@@ -1,34 +1,34 @@
-package org.apache.maven.plugins.shade.relocation;
-
-/*
- * 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.
- */
-
-/** @author Jason van Zyl */
-public interface Relocator
-{
- String ROLE = Relocator.class.getName();
-
- boolean canRelocatePath( String clazz );
-
- String relocatePath( String clazz );
-
- boolean canRelocateClass( String clazz );
-
- String relocateClass( String clazz );
-}
+package org.apache.maven.plugins.shade.relocation;
+
+/*
+ * 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.
+ */
+
+/** @author Jason van Zyl */
+public interface Relocator
+{
+ String ROLE = Relocator.class.getName();
+
+ boolean canRelocatePath( String clazz );
+
+ String relocatePath( String clazz );
+
+ boolean canRelocateClass( String clazz );
+
+ String relocateClass( String clazz );
+}
Propchange: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/relocation/Relocator.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/relocation/SimpleRelocator.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/relocation/SimpleRelocator.java?rev=640405&r1=640404&r2=640405&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/relocation/SimpleRelocator.java (original)
+++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/relocation/SimpleRelocator.java Mon Mar 24 06:17:58 2008
@@ -1,126 +1,126 @@
-package org.apache.maven.plugins.shade.relocation;
-
-/*
- * 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.
- */
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * @author Jason van Zyl
- * @author Mauro Talevi
- */
-public class SimpleRelocator
- implements Relocator
-{
- private String pattern;
-
- private String pathPattern;
-
- private String shadedPattern;
-
- private String shadedPathPattern;
-
- private List excludes;
-
- public SimpleRelocator(String patt, String shadedPattern, List excludes)
- {
- this.pattern = patt;
- this.pathPattern = patt.replace('.', '/');
-
- if ( shadedPattern != null )
- {
- this.shadedPattern = shadedPattern;
- this.shadedPathPattern = shadedPattern.replace('.', '/');
- } else
- {
- this.shadedPattern = "hidden." + this.pattern;
- this.shadedPathPattern = "hidden/" + this.pathPattern;
- }
-
- if (excludes != null)
- {
- this.excludes = new ArrayList();
-
- for (Iterator i = excludes.iterator(); i.hasNext();)
- {
- String e = (String) i.next();
-
- this.excludes.add(e.replace('.', '/'));
- }
- }
- }
-
- public boolean canRelocatePath( String clazz )
- {
- if ( excludes != null )
- {
- for ( Iterator i = excludes.iterator(); i.hasNext(); )
- {
- String exclude = (String) i.next();
-
- // Remember we have converted "." -> "/" in the constructor. So ".*" is really "/*"
- if ( exclude.endsWith( "/*" ) && clazz.startsWith( exclude.substring( 0, exclude.length() - 2 ) ) )
- {
- return false;
- }
- else if ( clazz.equals( exclude ) )
- {
- return false;
- }
- }
- }
-
- return clazz.startsWith( pathPattern );
- }
-
- public boolean canRelocateClass( String clazz )
- {
- if ( excludes != null )
- {
- for ( Iterator i = excludes.iterator(); i.hasNext(); )
- {
- String exclude = (String) i.next();
-
- exclude = exclude.replace( '/', '.' );
- if ( exclude.endsWith( ".*" ) && clazz.startsWith( exclude.substring( 0, exclude.length() - 2 ) ) )
- {
- return false;
- }
- else if ( clazz.equals( exclude ) )
- {
- return false;
- }
- }
- }
-
- return clazz.startsWith( pattern );
- }
-
- public String relocatePath( String clazz )
- {
- return clazz.replaceFirst(pathPattern, shadedPathPattern);
- }
-
- public String relocateClass( String clazz )
- {
- return clazz.replaceFirst(pattern, shadedPattern);
- }
-}
+package org.apache.maven.plugins.shade.relocation;
+
+/*
+ * 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.
+ */
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author Jason van Zyl
+ * @author Mauro Talevi
+ */
+public class SimpleRelocator
+ implements Relocator
+{
+ private String pattern;
+
+ private String pathPattern;
+
+ private String shadedPattern;
+
+ private String shadedPathPattern;
+
+ private List excludes;
+
+ public SimpleRelocator(String patt, String shadedPattern, List excludes)
+ {
+ this.pattern = patt;
+ this.pathPattern = patt.replace('.', '/');
+
+ if ( shadedPattern != null )
+ {
+ this.shadedPattern = shadedPattern;
+ this.shadedPathPattern = shadedPattern.replace('.', '/');
+ } else
+ {
+ this.shadedPattern = "hidden." + this.pattern;
+ this.shadedPathPattern = "hidden/" + this.pathPattern;
+ }
+
+ if (excludes != null)
+ {
+ this.excludes = new ArrayList();
+
+ for (Iterator i = excludes.iterator(); i.hasNext();)
+ {
+ String e = (String) i.next();
+
+ this.excludes.add(e.replace('.', '/'));
+ }
+ }
+ }
+
+ public boolean canRelocatePath( String clazz )
+ {
+ if ( excludes != null )
+ {
+ for ( Iterator i = excludes.iterator(); i.hasNext(); )
+ {
+ String exclude = (String) i.next();
+
+ // Remember we have converted "." -> "/" in the constructor. So ".*" is really "/*"
+ if ( exclude.endsWith( "/*" ) && clazz.startsWith( exclude.substring( 0, exclude.length() - 2 ) ) )
+ {
+ return false;
+ }
+ else if ( clazz.equals( exclude ) )
+ {
+ return false;
+ }
+ }
+ }
+
+ return clazz.startsWith( pathPattern );
+ }
+
+ public boolean canRelocateClass( String clazz )
+ {
+ if ( excludes != null )
+ {
+ for ( Iterator i = excludes.iterator(); i.hasNext(); )
+ {
+ String exclude = (String) i.next();
+
+ exclude = exclude.replace( '/', '.' );
+ if ( exclude.endsWith( ".*" ) && clazz.startsWith( exclude.substring( 0, exclude.length() - 2 ) ) )
+ {
+ return false;
+ }
+ else if ( clazz.equals( exclude ) )
+ {
+ return false;
+ }
+ }
+ }
+
+ return clazz.startsWith( pattern );
+ }
+
+ public String relocatePath( String clazz )
+ {
+ return clazz.replaceFirst(pathPattern, shadedPathPattern);
+ }
+
+ public String relocateClass( String clazz )
+ {
+ return clazz.replaceFirst(pattern, shadedPattern);
+ }
+}
Propchange: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/relocation/SimpleRelocator.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ApacheLicenseResourceTransformer.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ApacheLicenseResourceTransformer.java?rev=640405&r1=640404&r2=640405&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ApacheLicenseResourceTransformer.java (original)
+++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ApacheLicenseResourceTransformer.java Mon Mar 24 06:17:58 2008
@@ -1,64 +1,64 @@
-package org.apache.maven.plugins.shade.resource;
-
-/*
- * 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.
- */
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.jar.JarOutputStream;
-
-/**
- * Prevents duplicate copies of the license
- *
- */
-public class ApacheLicenseResourceTransformer
- implements ResourceTransformer
-{
- Set entries = new HashSet();
-
- public boolean canTransformResource( String resource )
- {
- String s = resource.toLowerCase();
-
- if ( s.startsWith( "meta-inf/license.txt" ) || s.equals( "meta-inf/license" ))
- {
- return true;
- }
-
- return false;
- }
-
- public void processResource( InputStream is )
- throws IOException
- {
-
- }
-
- public boolean hasTransformedResource()
- {
- return false;
- }
-
- public void modifyOutputStream( JarOutputStream os )
- throws IOException
- {
- }
-}
+package org.apache.maven.plugins.shade.resource;
+
+/*
+ * 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.
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.jar.JarOutputStream;
+
+/**
+ * Prevents duplicate copies of the license
+ *
+ */
+public class ApacheLicenseResourceTransformer
+ implements ResourceTransformer
+{
+ Set entries = new HashSet();
+
+ public boolean canTransformResource( String resource )
+ {
+ String s = resource.toLowerCase();
+
+ if ( s.startsWith( "meta-inf/license.txt" ) || s.equals( "meta-inf/license" ))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ public void processResource( InputStream is )
+ throws IOException
+ {
+
+ }
+
+ public boolean hasTransformedResource()
+ {
+ return false;
+ }
+
+ public void modifyOutputStream( JarOutputStream os )
+ throws IOException
+ {
+ }
+}
Propchange: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ApacheLicenseResourceTransformer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ApacheNoticeResourceTransformer.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ApacheNoticeResourceTransformer.java?rev=640405&r1=640404&r2=640405&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ApacheNoticeResourceTransformer.java (original)
+++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ApacheNoticeResourceTransformer.java Mon Mar 24 06:17:58 2008
@@ -1,234 +1,234 @@
-package org.apache.maven.plugins.shade.resource;
-
-/*
- * 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.
- */
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.jar.JarEntry;
-import java.util.jar.JarOutputStream;
-
-public class ApacheNoticeResourceTransformer
- implements ResourceTransformer
-{
- Set entries = new LinkedHashSet();
- Map organizationEntries = new LinkedHashMap();
-
- String projectName;
- boolean addHeader = true;
-
- String preamble1 =
- "// ------------------------------------------------------------------\n"
- + "// NOTICE file corresponding to the section 4d of The Apache License,\n"
- + "// Version 2.0, in this case for ";
-
- String preamble2 = "\n// ------------------------------------------------------------------\n";
-
- String preamble3 = "This product includes software developed at\n";
-
- //defaults overridable via config in pom
- String organizationName = "The Apache Software Foundation";
- String organizationURL = "http://www.apache.org/";
- String inceptionYear = "2006";
-
- String copyright;
-
-
- public boolean canTransformResource( String resource )
- {
- String s = resource.toLowerCase();
-
- if (s.equals( "meta-inf/notice.txt" ) || s.equals( "meta-inf/notice" ) )
- {
- return true;
- }
-
- return false;
- }
-
- public void processResource( InputStream is )
- throws IOException
- {
- if ( entries.isEmpty() )
- {
- String year = new SimpleDateFormat( "yyyy" ).format( new Date() );
- if ( !inceptionYear.equals( year ) )
- {
- year = inceptionYear + "-" + year;
- }
-
-
- //add headers
- if ( addHeader )
- {
- entries.add( preamble1 + projectName + preamble2 );
- }
- else
- {
- entries.add("");
- }
- //fake second entry, we'll look for a real one later
- entries.add( projectName + "\nCopyright " + year + " " + organizationName + "\n" );
- entries.add( preamble3 + organizationName + " ("+ organizationURL +").\n" );
- }
-
-
- BufferedReader reader = new BufferedReader(new InputStreamReader(is));
-
- String line = reader.readLine();
- StringBuffer sb = new StringBuffer();
- Set currentOrg = null;
- int lineCount = 0;
- while ( line != null )
- {
- String trimedLine = line.trim();
-
- if ( !trimedLine.startsWith( "//" ) )
- {
- if ( trimedLine.length() > 0 )
- {
- if ( trimedLine.startsWith( "- " ) )
- {
- //resource-bundle 1.3 mode
- if ( lineCount == 1
- && sb.toString().indexOf( "This product includes/uses software(s) developed by" ) != -1)
- {
- currentOrg = (Set) organizationEntries.get( sb.toString().trim() );
- if ( currentOrg == null )
- {
- currentOrg = new TreeSet();
- organizationEntries.put( sb.toString().trim(), currentOrg );
- }
- sb = new StringBuffer();
- }
- else if ( sb.length() > 0 && currentOrg != null )
- {
- currentOrg.add( sb.toString() );
- sb = new StringBuffer();
- }
-
- }
- sb.append( line ).append( "\n" );
- lineCount++;
- }
- else
- {
- String ent = sb.toString();
- if ( ent.startsWith( projectName )
- && ent.indexOf( "Copyright " ) != -1 )
- {
- copyright = ent;
- }
- if ( currentOrg == null )
- {
- entries.add( ent );
- }
- else
- {
- currentOrg.add( ent );
- }
- sb = new StringBuffer();
- lineCount = 0;
- currentOrg = null;
- }
- }
-
- line = reader.readLine();
- }
- if ( sb.length() > 0 )
- {
- if ( currentOrg == null )
- {
- entries.add( sb.toString() );
- }
- else
- {
- currentOrg.add( sb.toString() );
- }
- }
- }
-
- public boolean hasTransformedResource()
- {
- return true;
- }
-
- public void modifyOutputStream( JarOutputStream jos )
- throws IOException
- {
- jos.putNextEntry( new JarEntry( "META-INF/NOTICE" ) );
-
- OutputStreamWriter pow = new OutputStreamWriter( jos );
- PrintWriter writer = new PrintWriter(pow);
-
- int count = 0;
- for ( Iterator itr = entries.iterator() ; itr.hasNext() ; )
- {
- ++count;
- String line = (String) itr.next();
- if ( line.equals( copyright ) && count != 2)
- {
- continue;
- }
-
- if ( count == 2 && copyright != null )
- {
- writer.print( copyright );
- writer.print( '\n' );
- }
- else
- {
- writer.print( line );
- writer.print( '\n' );
- }
- if (count == 3)
- {
- //do org stuff
- for (Iterator oit = organizationEntries.entrySet().iterator() ; oit.hasNext();)
- {
- Map.Entry entry = (Map.Entry) oit.next();
- writer.print( entry.getKey().toString() );
- writer.print( '\n' );
- Set entrySet = (Set)entry.getValue();
- for (Iterator eit = entrySet.iterator() ; eit.hasNext() ;)
- {
- writer.print( eit.next().toString() );
- }
- writer.print( '\n' );
- }
- }
- }
-
- writer.flush();
-
- entries.clear();
- }
-}
+package org.apache.maven.plugins.shade.resource;
+
+/*
+ * 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.
+ */
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.jar.JarEntry;
+import java.util.jar.JarOutputStream;
+
+public class ApacheNoticeResourceTransformer
+ implements ResourceTransformer
+{
+ Set entries = new LinkedHashSet();
+ Map organizationEntries = new LinkedHashMap();
+
+ String projectName;
+ boolean addHeader = true;
+
+ String preamble1 =
+ "// ------------------------------------------------------------------\n"
+ + "// NOTICE file corresponding to the section 4d of The Apache License,\n"
+ + "// Version 2.0, in this case for ";
+
+ String preamble2 = "\n// ------------------------------------------------------------------\n";
+
+ String preamble3 = "This product includes software developed at\n";
+
+ //defaults overridable via config in pom
+ String organizationName = "The Apache Software Foundation";
+ String organizationURL = "http://www.apache.org/";
+ String inceptionYear = "2006";
+
+ String copyright;
+
+
+ public boolean canTransformResource( String resource )
+ {
+ String s = resource.toLowerCase();
+
+ if (s.equals( "meta-inf/notice.txt" ) || s.equals( "meta-inf/notice" ) )
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ public void processResource( InputStream is )
+ throws IOException
+ {
+ if ( entries.isEmpty() )
+ {
+ String year = new SimpleDateFormat( "yyyy" ).format( new Date() );
+ if ( !inceptionYear.equals( year ) )
+ {
+ year = inceptionYear + "-" + year;
+ }
+
+
+ //add headers
+ if ( addHeader )
+ {
+ entries.add( preamble1 + projectName + preamble2 );
+ }
+ else
+ {
+ entries.add("");
+ }
+ //fake second entry, we'll look for a real one later
+ entries.add( projectName + "\nCopyright " + year + " " + organizationName + "\n" );
+ entries.add( preamble3 + organizationName + " ("+ organizationURL +").\n" );
+ }
+
+
+ BufferedReader reader = new BufferedReader(new InputStreamReader(is));
+
+ String line = reader.readLine();
+ StringBuffer sb = new StringBuffer();
+ Set currentOrg = null;
+ int lineCount = 0;
+ while ( line != null )
+ {
+ String trimedLine = line.trim();
+
+ if ( !trimedLine.startsWith( "//" ) )
+ {
+ if ( trimedLine.length() > 0 )
+ {
+ if ( trimedLine.startsWith( "- " ) )
+ {
+ //resource-bundle 1.3 mode
+ if ( lineCount == 1
+ && sb.toString().indexOf( "This product includes/uses software(s) developed by" ) != -1)
+ {
+ currentOrg = (Set) organizationEntries.get( sb.toString().trim() );
+ if ( currentOrg == null )
+ {
+ currentOrg = new TreeSet();
+ organizationEntries.put( sb.toString().trim(), currentOrg );
+ }
+ sb = new StringBuffer();
+ }
+ else if ( sb.length() > 0 && currentOrg != null )
+ {
+ currentOrg.add( sb.toString() );
+ sb = new StringBuffer();
+ }
+
+ }
+ sb.append( line ).append( "\n" );
+ lineCount++;
+ }
+ else
+ {
+ String ent = sb.toString();
+ if ( ent.startsWith( projectName )
+ && ent.indexOf( "Copyright " ) != -1 )
+ {
+ copyright = ent;
+ }
+ if ( currentOrg == null )
+ {
+ entries.add( ent );
+ }
+ else
+ {
+ currentOrg.add( ent );
+ }
+ sb = new StringBuffer();
+ lineCount = 0;
+ currentOrg = null;
+ }
+ }
+
+ line = reader.readLine();
+ }
+ if ( sb.length() > 0 )
+ {
+ if ( currentOrg == null )
+ {
+ entries.add( sb.toString() );
+ }
+ else
+ {
+ currentOrg.add( sb.toString() );
+ }
+ }
+ }
+
+ public boolean hasTransformedResource()
+ {
+ return true;
+ }
+
+ public void modifyOutputStream( JarOutputStream jos )
+ throws IOException
+ {
+ jos.putNextEntry( new JarEntry( "META-INF/NOTICE" ) );
+
+ OutputStreamWriter pow = new OutputStreamWriter( jos );
+ PrintWriter writer = new PrintWriter(pow);
+
+ int count = 0;
+ for ( Iterator itr = entries.iterator() ; itr.hasNext() ; )
+ {
+ ++count;
+ String line = (String) itr.next();
+ if ( line.equals( copyright ) && count != 2)
+ {
+ continue;
+ }
+
+ if ( count == 2 && copyright != null )
+ {
+ writer.print( copyright );
+ writer.print( '\n' );
+ }
+ else
+ {
+ writer.print( line );
+ writer.print( '\n' );
+ }
+ if (count == 3)
+ {
+ //do org stuff
+ for (Iterator oit = organizationEntries.entrySet().iterator() ; oit.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry) oit.next();
+ writer.print( entry.getKey().toString() );
+ writer.print( '\n' );
+ Set entrySet = (Set)entry.getValue();
+ for (Iterator eit = entrySet.iterator() ; eit.hasNext() ;)
+ {
+ writer.print( eit.next().toString() );
+ }
+ writer.print( '\n' );
+ }
+ }
+ }
+
+ writer.flush();
+
+ entries.clear();
+ }
+}
Propchange: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ApacheNoticeResourceTransformer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/AppendingTransformer.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/AppendingTransformer.java?rev=640405&r1=640404&r2=640405&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/AppendingTransformer.java (original)
+++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/AppendingTransformer.java Mon Mar 24 06:17:58 2008
@@ -1,71 +1,71 @@
-package org.apache.maven.plugins.shade.resource;
-
-/*
- * 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.
- */
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.jar.JarEntry;
-import java.util.jar.JarOutputStream;
-
-import org.codehaus.plexus.util.IOUtil;
-
-public class AppendingTransformer
- implements ResourceTransformer
-{
- String resource;
- ByteArrayOutputStream data = new ByteArrayOutputStream();
-
- public boolean canTransformResource( String r )
- {
- r = r.toLowerCase();
-
- if (resource != null && resource.toLowerCase().equals(r))
- {
- return true;
- }
-
- return false;
- }
-
- public void processResource( InputStream is )
- throws IOException
- {
- IOUtil.copy(is, data);
- data.write('\n');
-
- is.close();
- }
-
- public boolean hasTransformedResource()
- {
- return data.size() > 0;
- }
-
- public void modifyOutputStream( JarOutputStream jos )
- throws IOException
- {
- jos.putNextEntry( new JarEntry( resource ) );
-
- IOUtil.copy(new ByteArrayInputStream(data.toByteArray()), jos);
- data.reset();
- }
-}
+package org.apache.maven.plugins.shade.resource;
+
+/*
+ * 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.
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.jar.JarEntry;
+import java.util.jar.JarOutputStream;
+
+import org.codehaus.plexus.util.IOUtil;
+
+public class AppendingTransformer
+ implements ResourceTransformer
+{
+ String resource;
+ ByteArrayOutputStream data = new ByteArrayOutputStream();
+
+ public boolean canTransformResource( String r )
+ {
+ r = r.toLowerCase();
+
+ if (resource != null && resource.toLowerCase().equals(r))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ public void processResource( InputStream is )
+ throws IOException
+ {
+ IOUtil.copy(is, data);
+ data.write('\n');
+
+ is.close();
+ }
+
+ public boolean hasTransformedResource()
+ {
+ return data.size() > 0;
+ }
+
+ public void modifyOutputStream( JarOutputStream jos )
+ throws IOException
+ {
+ jos.putNextEntry( new JarEntry( resource ) );
+
+ IOUtil.copy(new ByteArrayInputStream(data.toByteArray()), jos);
+ data.reset();
+ }
+}
Propchange: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/AppendingTransformer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ComponentsXmlResourceTransformer.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ComponentsXmlResourceTransformer.java?rev=640405&r1=640404&r2=640405&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ComponentsXmlResourceTransformer.java (original)
+++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ComponentsXmlResourceTransformer.java Mon Mar 24 06:17:58 2008
@@ -1,167 +1,167 @@
-package org.apache.maven.plugins.shade.resource;
-
-/*
- * 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.
- */
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Reader;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.jar.JarEntry;
-import java.util.jar.JarOutputStream;
-
-import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.xml.Xpp3Dom;
-import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
-import org.codehaus.plexus.util.xml.Xpp3DomWriter;
-
-// 1. We want to process all resources that are common in all the JARs that we are processing.
-// 2. At the end of processing we want to hand back the transformation of the resources.
-
-// In my particular case I want to grab all the plexus components.xml files and aggregate them
-// and then stick them in one place in the aggregated JAR.
-
-public class ComponentsXmlResourceTransformer
- implements ResourceTransformer
-{
- private Map components = new LinkedHashMap();
-
- public static final String COMPONENTS_XML_PATH = "META-INF/plexus/components.xml";
-
- public boolean canTransformResource( String resource )
- {
- return COMPONENTS_XML_PATH.equals( resource );
- }
-
- public void processResource( InputStream is )
- throws IOException
- {
- // We can't just read the stream because the plexus dom builder closes the stream
-
- File f = File.createTempFile( "maven-shade-plugin", "tmp" );
-
- f.deleteOnExit();
-
- String n = f.getAbsolutePath();
-
- OutputStream os = new FileOutputStream( f );
-
- IOUtil.copy( is, os );
-
- os.close();
-
- //
-
- Reader reader;
-
- Xpp3Dom newDom;
-
- try
- {
- reader = new FileReader( n );
-
- newDom = Xpp3DomBuilder.build( reader );
- }
- catch ( Exception e )
- {
- throw new IOException( "Error parsing components.xml in " + is );
- }
-
- // Only try to merge in components if there are some elements in the component-set
- if ( newDom.getChild( "components" ) == null )
- {
- return;
- }
-
- Xpp3Dom[] children = newDom.getChild( "components" ).getChildren( "component" );
-
- for ( int i = 0; i < children.length; i++ )
- {
- Xpp3Dom component = children[i];
-
- String role = component.getChild( "role" ).getValue();
-
- Xpp3Dom child = component.getChild( "role-hint" );
-
- String roleHint = child != null ? child.getValue() : "";
-
- components.put( role + roleHint, component );
- }
- }
-
- public void modifyOutputStream( JarOutputStream jos )
- throws IOException
- {
- Reader reader = new FileReader( getTransformedResource() );
-
- jos.putNextEntry( new JarEntry( COMPONENTS_XML_PATH ) );
-
- IOUtil.copy( reader, jos );
-
- reader.close();
-
- components.clear();
- }
-
- public boolean hasTransformedResource()
- {
- return components.size() > 0;
- }
-
- public File getTransformedResource()
- throws IOException
- {
- File f = File.createTempFile( "shade-maven-plugin-plx", "tmp" );
-
- f.deleteOnExit();
-
- FileWriter fileWriter = new FileWriter( f );
- try
- {
- Xpp3Dom dom = new Xpp3Dom( "component-set" );
-
- Xpp3Dom componentDom = new Xpp3Dom( "components" );
-
- dom.addChild( componentDom );
-
- for ( Iterator i = components.values().iterator(); i.hasNext(); )
- {
- Xpp3Dom component = (Xpp3Dom) i.next();
- componentDom.addChild( component );
- }
-
- Xpp3DomWriter.write( fileWriter, dom );
- }
- finally
- {
- IOUtil.close( fileWriter );
- }
-
- return f;
- }
-
-
-}
+package org.apache.maven.plugins.shade.resource;
+
+/*
+ * 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.
+ */
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.jar.JarEntry;
+import java.util.jar.JarOutputStream;
+
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
+import org.codehaus.plexus.util.xml.Xpp3DomWriter;
+
+// 1. We want to process all resources that are common in all the JARs that we are processing.
+// 2. At the end of processing we want to hand back the transformation of the resources.
+
+// In my particular case I want to grab all the plexus components.xml files and aggregate them
+// and then stick them in one place in the aggregated JAR.
+
+public class ComponentsXmlResourceTransformer
+ implements ResourceTransformer
+{
+ private Map components = new LinkedHashMap();
+
+ public static final String COMPONENTS_XML_PATH = "META-INF/plexus/components.xml";
+
+ public boolean canTransformResource( String resource )
+ {
+ return COMPONENTS_XML_PATH.equals( resource );
+ }
+
+ public void processResource( InputStream is )
+ throws IOException
+ {
+ // We can't just read the stream because the plexus dom builder closes the stream
+
+ File f = File.createTempFile( "maven-shade-plugin", "tmp" );
+
+ f.deleteOnExit();
+
+ String n = f.getAbsolutePath();
+
+ OutputStream os = new FileOutputStream( f );
+
+ IOUtil.copy( is, os );
+
+ os.close();
+
+ //
+
+ Reader reader;
+
+ Xpp3Dom newDom;
+
+ try
+ {
+ reader = new FileReader( n );
+
+ newDom = Xpp3DomBuilder.build( reader );
+ }
+ catch ( Exception e )
+ {
+ throw new IOException( "Error parsing components.xml in " + is );
+ }
+
+ // Only try to merge in components if there are some elements in the component-set
+ if ( newDom.getChild( "components" ) == null )
+ {
+ return;
+ }
+
+ Xpp3Dom[] children = newDom.getChild( "components" ).getChildren( "component" );
+
+ for ( int i = 0; i < children.length; i++ )
+ {
+ Xpp3Dom component = children[i];
+
+ String role = component.getChild( "role" ).getValue();
+
+ Xpp3Dom child = component.getChild( "role-hint" );
+
+ String roleHint = child != null ? child.getValue() : "";
+
+ components.put( role + roleHint, component );
+ }
+ }
+
+ public void modifyOutputStream( JarOutputStream jos )
+ throws IOException
+ {
+ Reader reader = new FileReader( getTransformedResource() );
+
+ jos.putNextEntry( new JarEntry( COMPONENTS_XML_PATH ) );
+
+ IOUtil.copy( reader, jos );
+
+ reader.close();
+
+ components.clear();
+ }
+
+ public boolean hasTransformedResource()
+ {
+ return components.size() > 0;
+ }
+
+ public File getTransformedResource()
+ throws IOException
+ {
+ File f = File.createTempFile( "shade-maven-plugin-plx", "tmp" );
+
+ f.deleteOnExit();
+
+ FileWriter fileWriter = new FileWriter( f );
+ try
+ {
+ Xpp3Dom dom = new Xpp3Dom( "component-set" );
+
+ Xpp3Dom componentDom = new Xpp3Dom( "components" );
+
+ dom.addChild( componentDom );
+
+ for ( Iterator i = components.values().iterator(); i.hasNext(); )
+ {
+ Xpp3Dom component = (Xpp3Dom) i.next();
+ componentDom.addChild( component );
+ }
+
+ Xpp3DomWriter.write( fileWriter, dom );
+ }
+ finally
+ {
+ IOUtil.close( fileWriter );
+ }
+
+ return f;
+ }
+
+
+}
Propchange: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ComponentsXmlResourceTransformer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ResourceTransformer.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ResourceTransformer.java?rev=640405&r1=640404&r2=640405&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ResourceTransformer.java (original)
+++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ResourceTransformer.java Mon Mar 24 06:17:58 2008
@@ -1,38 +1,38 @@
-package org.apache.maven.plugins.shade.resource;
-
-/*
- * 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.
- */
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.jar.JarOutputStream;
-
-/** @author Jason van Zyl */
-public interface ResourceTransformer
-{
- boolean canTransformResource( String resource );
-
- void processResource( InputStream is )
- throws IOException;
-
- boolean hasTransformedResource();
-
- void modifyOutputStream( JarOutputStream os )
- throws IOException;
-}
+package org.apache.maven.plugins.shade.resource;
+
+/*
+ * 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.
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.jar.JarOutputStream;
+
+/** @author Jason van Zyl */
+public interface ResourceTransformer
+{
+ boolean canTransformResource( String resource );
+
+ void processResource( InputStream is )
+ throws IOException;
+
+ boolean hasTransformedResource();
+
+ void modifyOutputStream( JarOutputStream os )
+ throws IOException;
+}
Propchange: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ResourceTransformer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/XmlAppendingTransformer.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/XmlAppendingTransformer.java?rev=640405&r1=640404&r2=640405&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/XmlAppendingTransformer.java (original)
+++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/XmlAppendingTransformer.java Mon Mar 24 06:17:58 2008
@@ -1,115 +1,115 @@
-package org.apache.maven.plugins.shade.resource;
-
-/*
- * 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.
- */
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Iterator;
-import java.util.jar.JarEntry;
-import java.util.jar.JarOutputStream;
-
-import org.jdom.Attribute;
-import org.jdom.Content;
-import org.jdom.Document;
-import org.jdom.Element;
-import org.jdom.JDOMException;
-import org.jdom.input.SAXBuilder;
-import org.jdom.output.Format;
-import org.jdom.output.XMLOutputter;
-
-public class XmlAppendingTransformer
- implements ResourceTransformer
-{
- public static final String XSI_NS = "http://www.w3.org/2001/XMLSchema-instance";
-
- String resource;
- Document doc;
-
- public boolean canTransformResource( String r )
- {
- r = r.toLowerCase();
-
- if (resource != null && resource.toLowerCase().equals(r))
- {
- return true;
- }
-
- return false;
- }
-
- public void processResource( InputStream is )
- throws IOException
- {
- Document r;
- try
- {
- r = new SAXBuilder().build(is);
- }
- catch (JDOMException e)
- {
- throw new RuntimeException(e);
- }
-
- if (doc == null)
- {
- doc = r;
- }
- else
- {
- Element root = r.getRootElement();
-
- for (Iterator itr = root.getAttributes().iterator(); itr.hasNext();)
- {
- Attribute a = (Attribute) itr.next();
- itr.remove();
-
- Element mergedEl = doc.getRootElement();
- Attribute mergedAtt = mergedEl.getAttribute(a.getName(), a.getNamespace());
- if (mergedAtt == null)
- {
- mergedEl.setAttribute(a);
- }
- }
-
- for (Iterator itr = root.getChildren().iterator(); itr.hasNext();)
- {
- Content n = (Content) itr.next();
- itr.remove();
-
- doc.getRootElement().addContent(n);
- }
- }
- }
-
- public boolean hasTransformedResource()
- {
- return doc != null;
- }
-
- public void modifyOutputStream( JarOutputStream jos )
- throws IOException
- {
- jos.putNextEntry( new JarEntry( resource ) );
-
- new XMLOutputter(Format.getPrettyFormat()).output(doc, jos);
-
- doc = null;
- }
-}
+package org.apache.maven.plugins.shade.resource;
+
+/*
+ * 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.
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Iterator;
+import java.util.jar.JarEntry;
+import java.util.jar.JarOutputStream;
+
+import org.jdom.Attribute;
+import org.jdom.Content;
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.JDOMException;
+import org.jdom.input.SAXBuilder;
+import org.jdom.output.Format;
+import org.jdom.output.XMLOutputter;
+
+public class XmlAppendingTransformer
+ implements ResourceTransformer
+{
+ public static final String XSI_NS = "http://www.w3.org/2001/XMLSchema-instance";
+
+ String resource;
+ Document doc;
+
+ public boolean canTransformResource( String r )
+ {
+ r = r.toLowerCase();
+
+ if (resource != null && resource.toLowerCase().equals(r))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ public void processResource( InputStream is )
+ throws IOException
+ {
+ Document r;
+ try
+ {
+ r = new SAXBuilder().build(is);
+ }
+ catch (JDOMException e)
+ {
+ throw new RuntimeException(e);
+ }
+
+ if (doc == null)
+ {
+ doc = r;
+ }
+ else
+ {
+ Element root = r.getRootElement();
+
+ for (Iterator itr = root.getAttributes().iterator(); itr.hasNext();)
+ {
+ Attribute a = (Attribute) itr.next();
+ itr.remove();
+
+ Element mergedEl = doc.getRootElement();
+ Attribute mergedAtt = mergedEl.getAttribute(a.getName(), a.getNamespace());
+ if (mergedAtt == null)
+ {
+ mergedEl.setAttribute(a);
+ }
+ }
+
+ for (Iterator itr = root.getChildren().iterator(); itr.hasNext();)
+ {
+ Content n = (Content) itr.next();
+ itr.remove();
+
+ doc.getRootElement().addContent(n);
+ }
+ }
+ }
+
+ public boolean hasTransformedResource()
+ {
+ return doc != null;
+ }
+
+ public void modifyOutputStream( JarOutputStream jos )
+ throws IOException
+ {
+ jos.putNextEntry( new JarEntry( resource ) );
+
+ new XMLOutputter(Format.getPrettyFormat()).output(doc, jos);
+
+ doc = null;
+ }
+}
Propchange: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/XmlAppendingTransformer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-shade-plugin/src/site/apt/examples.apt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-shade-plugin/src/site/apt/index.apt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-shade-plugin/src/site/apt/usage.apt
------------------------------------------------------------------------------
svn:eol-style = native
Modified: maven/plugins/trunk/maven-shade-plugin/src/site/site.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/site/site.xml?rev=640405&r1=640404&r2=640405&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/site/site.xml (original)
+++ maven/plugins/trunk/maven-shade-plugin/src/site/site.xml Mon Mar 24 06:17:58 2008
@@ -1,22 +1,22 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- 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.
+<!--
+ 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.
-->
<project name="Maven Shade Plugin">
Propchange: maven/plugins/trunk/maven-shade-plugin/src/site/site.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: maven/plugins/trunk/maven-shade-plugin/src/test/java/org/apache/maven/plugins/shade/DefaultShaderTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/test/java/org/apache/maven/plugins/shade/DefaultShaderTest.java?rev=640405&r1=640404&r2=640405&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/test/java/org/apache/maven/plugins/shade/DefaultShaderTest.java (original)
+++ maven/plugins/trunk/maven-shade-plugin/src/test/java/org/apache/maven/plugins/shade/DefaultShaderTest.java Mon Mar 24 06:17:58 2008
@@ -1,116 +1,116 @@
-package org.apache.maven.plugins.shade;
-
-/*
- * 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.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.net.URLClassLoader;
-import java.net.URL;
-
-import junit.framework.TestCase;
-
-import org.apache.maven.plugins.shade.relocation.SimpleRelocator;
-import org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer;
-
-/**
- * @author Jason van Zyl
- * @author Mauro Talevi
- */
-public class DefaultShaderTest
- extends TestCase
-{
- private static final String[] EXCLUDES = new String[] {
- "org/codehaus/plexus/util/xml/Xpp3Dom",
- "org/codehaus/plexus/util/xml/pull.*" };
-
- public void testShaderWithDefaultShadedPattern()
- throws Exception
- {
- shaderWithPattern( null, new File( "target/foo-default.jar" ), EXCLUDES );
- }
-
- public void testShaderWithStaticInitializedClass()
- throws Exception
- {
- Shader s = new DefaultShader();
-
- Set set = new HashSet();
-
- set.add( new File( "src/test/jars/test-artifact-1.0-SNAPSHOT.jar" ) );
-
- List relocators = new ArrayList();
-
- relocators.add( new SimpleRelocator( "org.apache.maven.plugins.shade", null, null ) );
-
- List resourceTransformers = new ArrayList();
-
- List filters = new ArrayList();
-
- File file = new File( "target/testShaderWithStaticInitializedClass.jar" );
- s.shade( set, file, filters, relocators, resourceTransformers );
-
- URLClassLoader cl = new URLClassLoader( new URL[]{file.toURL()} );
- Class c = cl.loadClass( "hidden.org.apache.maven.plugins.shade.Lib" );
- Object o = c.newInstance();
- assertEquals( "foo.bar/baz", c.getDeclaredField( "CONSTANT" ).get( o ) );
- }
-
- public void testShaderWithCustomShadedPattern()
- throws Exception
- {
- shaderWithPattern( "org/shaded/plexus/util", new File( "target/foo-custom.jar" ), EXCLUDES );
- }
-
- public void testShaderWithoutExcludesShouldRemoveReferencesOfOriginalPattern()
- throws Exception
- {
- //FIXME: shaded jar should not include references to org/codehaus/* (empty dirs) or org.codehaus.* META-INF files.
- shaderWithPattern( "org/shaded/plexus/util", new File( "target/foo-custom-without-excludes.jar" ), new String[] {} );
- }
-
- public void shaderWithPattern( String shadedPattern, File jar, String[] excludes )
- throws Exception
- {
- Shader s = new DefaultShader();
-
- Set set = new HashSet();
-
- set.add( new File( "src/test/jars/test-project-1.0-SNAPSHOT.jar" ) );
-
- set.add( new File( "src/test/jars/plexus-utils-1.4.1.jar" ) );
-
- List relocators = new ArrayList();
-
- relocators.add( new SimpleRelocator( "org/codehaus/plexus/util", shadedPattern, Arrays.asList( excludes ) ) );
-
- List resourceTransformers = new ArrayList();
-
- resourceTransformers.add( new ComponentsXmlResourceTransformer() );
-
- List filters = new ArrayList();
-
- s.shade( set, jar, filters, relocators, resourceTransformers );
- }
-
-}
+package org.apache.maven.plugins.shade;
+
+/*
+ * 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.
+ */
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.net.URLClassLoader;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.maven.plugins.shade.relocation.SimpleRelocator;
+import org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer;
+
+/**
+ * @author Jason van Zyl
+ * @author Mauro Talevi
+ */
+public class DefaultShaderTest
+ extends TestCase
+{
+ private static final String[] EXCLUDES = new String[] {
+ "org/codehaus/plexus/util/xml/Xpp3Dom",
+ "org/codehaus/plexus/util/xml/pull.*" };
+
+ public void testShaderWithDefaultShadedPattern()
+ throws Exception
+ {
+ shaderWithPattern( null, new File( "target/foo-default.jar" ), EXCLUDES );
+ }
+
+ public void testShaderWithStaticInitializedClass()
+ throws Exception
+ {
+ Shader s = new DefaultShader();
+
+ Set set = new HashSet();
+
+ set.add( new File( "src/test/jars/test-artifact-1.0-SNAPSHOT.jar" ) );
+
+ List relocators = new ArrayList();
+
+ relocators.add( new SimpleRelocator( "org.apache.maven.plugins.shade", null, null ) );
+
+ List resourceTransformers = new ArrayList();
+
+ List filters = new ArrayList();
+
+ File file = new File( "target/testShaderWithStaticInitializedClass.jar" );
+ s.shade( set, file, filters, relocators, resourceTransformers );
+
+ URLClassLoader cl = new URLClassLoader( new URL[]{file.toURL()} );
+ Class c = cl.loadClass( "hidden.org.apache.maven.plugins.shade.Lib" );
+ Object o = c.newInstance();
+ assertEquals( "foo.bar/baz", c.getDeclaredField( "CONSTANT" ).get( o ) );
+ }
+
+ public void testShaderWithCustomShadedPattern()
+ throws Exception
+ {
+ shaderWithPattern( "org/shaded/plexus/util", new File( "target/foo-custom.jar" ), EXCLUDES );
+ }
+
+ public void testShaderWithoutExcludesShouldRemoveReferencesOfOriginalPattern()
+ throws Exception
+ {
+ //FIXME: shaded jar should not include references to org/codehaus/* (empty dirs) or org.codehaus.* META-INF files.
+ shaderWithPattern( "org/shaded/plexus/util", new File( "target/foo-custom-without-excludes.jar" ), new String[] {} );
+ }
+
+ public void shaderWithPattern( String shadedPattern, File jar, String[] excludes )
+ throws Exception
+ {
+ Shader s = new DefaultShader();
+
+ Set set = new HashSet();
+
+ set.add( new File( "src/test/jars/test-project-1.0-SNAPSHOT.jar" ) );
+
+ set.add( new File( "src/test/jars/plexus-utils-1.4.1.jar" ) );
+
+ List relocators = new ArrayList();
+
+ relocators.add( new SimpleRelocator( "org/codehaus/plexus/util", shadedPattern, Arrays.asList( excludes ) ) );
+
+ List resourceTransformers = new ArrayList();
+
+ resourceTransformers.add( new ComponentsXmlResourceTransformer() );
+
+ List filters = new ArrayList();
+
+ s.shade( set, jar, filters, relocators, resourceTransformers );
+ }
+
+}
Propchange: maven/plugins/trunk/maven-shade-plugin/src/test/java/org/apache/maven/plugins/shade/DefaultShaderTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: maven/plugins/trunk/maven-shade-plugin/src/test/java/org/apache/maven/plugins/shade/mojo/ShadeMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/test/java/org/apache/maven/plugins/shade/mojo/ShadeMojoTest.java?rev=640405&r1=640404&r2=640405&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/test/java/org/apache/maven/plugins/shade/mojo/ShadeMojoTest.java (original)
+++ maven/plugins/trunk/maven-shade-plugin/src/test/java/org/apache/maven/plugins/shade/mojo/ShadeMojoTest.java Mon Mar 24 06:17:58 2008
@@ -1,79 +1,79 @@
-package org.apache.maven.plugins.shade.mojo;
-
-/*
- * 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.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.maven.plugins.shade.Shader;
-import org.apache.maven.plugins.shade.relocation.SimpleRelocator;
-import org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer;
-import org.codehaus.plexus.PlexusTestCase;
-
-
-/**
- * @author Jason van Zyl
- * @author Mauro Talevi
- */
-public class ShadeMojoTest
- extends PlexusTestCase
-{
- public void testShaderWithDefaultShadedPattern()
- throws Exception
- {
- shaderWithPattern(null, new File( "target/foo-default.jar" ));
- }
-
- public void testShaderWithCustomShadedPattern()
- throws Exception
- {
- shaderWithPattern("org/shaded/plexus/util", new File( "target/foo-custom.jar" ));
- }
-
- public void shaderWithPattern(String shadedPattern, File jar)
- throws Exception
- {
- Shader s = (Shader) lookup( Shader.ROLE );
-
- Set set = new HashSet();
-
- set.add( new File( getBasedir(), "src/test/jars/test-project-1.0-SNAPSHOT.jar" ) );
-
- set.add( new File( getBasedir(), "src/test/jars/plexus-utils-1.4.1.jar" ) );
-
- List relocators = new ArrayList();
-
- relocators.add( new SimpleRelocator( "org/codehaus/plexus/util", shadedPattern, Arrays.asList(
- new String[]{"org/codehaus/plexus/util/xml/Xpp3Dom", "org/codehaus/plexus/util/xml/pull.*"} ) ) );
-
- List resourceTransformers = new ArrayList();
-
- resourceTransformers.add( new ComponentsXmlResourceTransformer() );
-
- List filters = new ArrayList();
-
- s.shade( set, jar, filters, relocators, resourceTransformers );
- }
-
-}
+package org.apache.maven.plugins.shade.mojo;
+
+/*
+ * 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.
+ */
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.maven.plugins.shade.Shader;
+import org.apache.maven.plugins.shade.relocation.SimpleRelocator;
+import org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer;
+import org.codehaus.plexus.PlexusTestCase;
+
+
+/**
+ * @author Jason van Zyl
+ * @author Mauro Talevi
+ */
+public class ShadeMojoTest
+ extends PlexusTestCase
+{
+ public void testShaderWithDefaultShadedPattern()
+ throws Exception
+ {
+ shaderWithPattern(null, new File( "target/foo-default.jar" ));
+ }
+
+ public void testShaderWithCustomShadedPattern()
+ throws Exception
+ {
+ shaderWithPattern("org/shaded/plexus/util", new File( "target/foo-custom.jar" ));
+ }
+
+ public void shaderWithPattern(String shadedPattern, File jar)
+ throws Exception
+ {
+ Shader s = (Shader) lookup( Shader.ROLE );
+
+ Set set = new HashSet();
+
+ set.add( new File( getBasedir(), "src/test/jars/test-project-1.0-SNAPSHOT.jar" ) );
+
+ set.add( new File( getBasedir(), "src/test/jars/plexus-utils-1.4.1.jar" ) );
+
+ List relocators = new ArrayList();
+
+ relocators.add( new SimpleRelocator( "org/codehaus/plexus/util", shadedPattern, Arrays.asList(
+ new String[]{"org/codehaus/plexus/util/xml/Xpp3Dom", "org/codehaus/plexus/util/xml/pull.*"} ) ) );
+
+ List resourceTransformers = new ArrayList();
+
+ resourceTransformers.add( new ComponentsXmlResourceTransformer() );
+
+ List filters = new ArrayList();
+
+ s.shade( set, jar, filters, relocators, resourceTransformers );
+ }
+
+}
Propchange: maven/plugins/trunk/maven-shade-plugin/src/test/java/org/apache/maven/plugins/shade/mojo/ShadeMojoTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-shade-plugin/src/test/projects/default-config-project/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native