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=612343&r1=612342&r2=612343&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 Tue Jan 15 19:35:30 2008 @@ -1,3 +1,5 @@ +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 @@ -17,8 +19,6 @@ * under the License. */ -package org.apache.maven.plugins.shade.resource; - import java.io.IOException; import java.io.InputStream; import java.util.Iterator; @@ -38,10 +38,10 @@ 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(); @@ -58,41 +58,41 @@ throws IOException { Document r; - try + try { r = new SAXBuilder().build(is); - } - catch (JDOMException e) + } + catch (JDOMException e) { throw new RuntimeException(e); } - - if (doc == null) + + if (doc == null) { doc = r; - } - else + } + 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) + 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); } } @@ -107,9 +107,9 @@ throws IOException { jos.putNextEntry( new JarEntry( resource ) ); - + new XMLOutputter(Format.getPrettyFormat()).output(doc, jos); - + doc = null; } }
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=612343&r1=612342&r2=612343&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 Tue Jan 15 19:35:30 2008 @@ -1,20 +1,24 @@ +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. + * 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.maven.plugins.shade; - import java.io.File; import java.util.ArrayList; import java.util.Arrays; @@ -27,8 +31,8 @@ import org.apache.maven.plugins.shade.relocation.SimpleRelocator; import org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer; -/** - * @author Jason van Zyl +/** + * @author Jason van Zyl * @author Mauro Talevi */ public class DefaultShaderTest 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=612343&r1=612342&r2=612343&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 Tue Jan 15 19:35:30 2008 @@ -1,3 +1,5 @@ +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 @@ -17,8 +19,6 @@ * under the License. */ -package org.apache.maven.plugins.shade.mojo; - import java.io.File; import java.util.ArrayList; import java.util.Arrays; @@ -32,8 +32,8 @@ import org.codehaus.plexus.PlexusTestCase; -/** - * @author Jason van Zyl +/** + * @author Jason van Zyl * @author Mauro Talevi */ public class ShadeMojoTest @@ -44,13 +44,13 @@ { 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 { @@ -73,5 +73,5 @@ s.shade( set, jar, relocators, resourceTransformers ); } - + }