Author: hboutemy Date: Fri Nov 28 21:33:29 2014 New Revision: 1642364 URL: http://svn.apache.org/r1642364 Log: updated parent pom and fixed errors reported by Checkstyle
Modified: maven/plugins/trunk/maven-shade-plugin/pom.xml maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/DefaultShader.java maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/filter/MinijarFilter.java maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/RelativizePath.java maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ApacheNoticeResourceTransformer.java maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/ComponentsXmlResourceTransformer.java maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/DontIncludeResourceTransformer.java Modified: maven/plugins/trunk/maven-shade-plugin/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/pom.xml?rev=1642364&r1=1642363&r2=1642364&view=diff ============================================================================== --- maven/plugins/trunk/maven-shade-plugin/pom.xml (original) +++ maven/plugins/trunk/maven-shade-plugin/pom.xml Fri Nov 28 21:33:29 2014 @@ -25,7 +25,7 @@ under the License. <parent> <artifactId>maven-plugins</artifactId> <groupId>org.apache.maven.plugins</groupId> - <version>25</version> + <version>27</version> <relativePath>../maven-plugins/pom.xml</relativePath> </parent> @@ -62,7 +62,6 @@ under the License. <properties> <mavenVersion>3.0</mavenVersion> <currentVersion>${project.version}</currentVersion> - <mavenPluginVersion>3.2</mavenPluginVersion> <asmVersion>5.0.2</asmVersion> </properties> @@ -105,7 +104,6 @@ under the License. <dependency> <groupId>org.apache.maven.plugin-tools</groupId> <artifactId>maven-plugin-annotations</artifactId> - <version>${mavenPluginVersion}</version> <scope>provided</scope> </dependency> @@ -176,7 +174,7 @@ under the License. <groupId>org.apache.rat</groupId> <artifactId>apache-rat-plugin</artifactId> <configuration> - <excludes> + <excludes combine.children="append"> <!-- Can't add license header otherwise the tests will fail. --> <exclude>rel-path-test-files/**</exclude> <exclude>src/it/dep-reduced-pom-use-base-version/repo/org/apache/maven/its/shade/drp/a/0.1-SNAPSHOT/_maven.repositories</exclude> @@ -192,23 +190,6 @@ under the License. <plugins> <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-plugin-plugin</artifactId> - <version>${mavenPluginVersion}</version> - <configuration> - <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound> - </configuration> - <executions> - <execution> - <id>mojo-descriptor</id> - <goals> - <goal>descriptor</goal> - </goals> - </execution> - </executions> - </plugin> - - <plugin> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-component-metadata</artifactId> <executions> Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/DefaultShader.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/DefaultShader.java?rev=1642364&r1=1642363&r2=1642364&view=diff ============================================================================== --- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/DefaultShader.java (original) +++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/DefaultShader.java Fri Nov 28 21:33:29 2014 @@ -117,7 +117,9 @@ public class DefaultShader } } + // CHECKSTYLE_OFF: MagicNumber Multimap<String, File> duplicates = HashMultimap.create( 10000, 3 ); + // CHECKSTYLE_ON: MagicNumber for ( File jar : shadeRequest.getJars() ) { @@ -195,7 +197,9 @@ public class DefaultShader jarFile.close(); } + // CHECKSTYLE_OFF: MagicNumber Multimap<Collection<File>, String> overlapping = HashMultimap.create( 20, 15 ); + // CHECKSTYLE_ON: MagicNumber for ( String clazz : duplicates.keySet() ) { @@ -212,22 +216,31 @@ public class DefaultShader List<String> jarzS = new LinkedList<String>(); for ( File jjar : jarz ) + { jarzS.add( jjar.getName() ); + } List<String> classes = new LinkedList<String>(); for ( String clazz : overlapping.get( jarz ) ) + { classes.add( clazz.replace( ".class", "" ).replace( "/", "." ) ); + } - getLogger().warn( Joiner.on( ", " ).join( jarzS ) + " define " + classes.size() + " overlapping classes: " ); + getLogger().warn( Joiner.on( ", " ).join( jarzS ) + " define " + classes.size() + + " overlapping classes: " ); int max = 10; for ( int i = 0; i < Math.min( max, classes.size() ); i++ ) + { getLogger().warn( " - " + classes.get( i ) ); + } if ( classes.size() > max ) + { getLogger().warn( " - " + ( classes.size() - max ) + " more..." ); + } } Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/filter/MinijarFilter.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/filter/MinijarFilter.java?rev=1642364&r1=1642363&r2=1642364&view=diff ============================================================================== --- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/filter/MinijarFilter.java (original) +++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/filter/MinijarFilter.java Fri Nov 28 21:33:29 2014 @@ -64,7 +64,7 @@ public class MinijarFilter /** * @since 1.6 */ - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings( { "unchecked" } ) public MinijarFilter( MavenProject project, Log log, List<SimpleFilter> simpleFilters ) throws IOException { @@ -132,7 +132,7 @@ public class MinijarFilter removePackages( artifactUnit.getTransitiveDependencies(), packageNames ); } - @SuppressWarnings("rawtypes") + @SuppressWarnings( "rawtypes" ) private void removePackages( Set clazzes, Set<String> packageNames ) { for ( Object clazze : clazzes ) Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/RelativizePath.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/RelativizePath.java?rev=1642364&r1=1642363&r2=1642364&view=diff ============================================================================== --- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/RelativizePath.java (original) +++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/RelativizePath.java Fri Nov 28 21:33:29 2014 @@ -37,7 +37,8 @@ public final class RelativizePath /** * relativize a pathname. * @param thing Absolute File of something. (e.g., a parent pom) - * @param relativeTo base to relativize it do. (e.g., a pom into which a relative pathname to the 'thing' is to be installed). + * @param relativeTo base to relativize it do. (e.g., a pom into which a relative pathname to the 'thing' is to be + * installed). * @return */ static String convertToRelativePath( File thing, File relativeTo ) @@ -53,7 +54,9 @@ public final class RelativizePath List<String> relativeToDirectories = RelativizePath.parentDirs( relativeTo ); //Get the shortest of the two paths - int length = thingDirectories.size() < relativeToDirectories.size() ? thingDirectories.size() : relativeToDirectories.size(); + int length = + thingDirectories.size() < relativeToDirectories.size() ? thingDirectories.size() + : relativeToDirectories.size(); int lastCommonRoot = -1; // index of the lowest directory down from the root that the two have in common. int index; @@ -83,7 +86,7 @@ public final class RelativizePath // now add down from the common point to the actual 'thing' item. for ( index = lastCommonRoot + 1; index < thingDirectories.size(); index++ ) { - relativePath.append(thingDirectories.get(index)).append('/'); + relativePath.append( thingDirectories.get( index ) ).append( '/' ); } relativePath.append( thing.getName() ); return relativePath.toString(); Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java?rev=1642364&r1=1642363&r2=1642364&view=diff ============================================================================== --- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java (original) +++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/pom/MavenJDOMWriter.java Fri Nov 28 21:33:29 2014 @@ -19,7 +19,6 @@ package org.apache.maven.plugins.shade.p * under the License. */ - import org.apache.maven.model.ActivationFile; import org.apache.maven.model.ActivationOS; import org.apache.maven.model.ActivationProperty; @@ -74,7 +73,12 @@ import org.jdom.output.XMLOutputter; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.Writer; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Map; /** * Class MavenJDOMWriter. @@ -1128,33 +1132,40 @@ public class MavenJDOMWriter { Xpp3Dom[] childs = parentDom.getChildren(); Collection domChilds = new ArrayList(); - Collections.addAll(domChilds, childs); + Collections.addAll( domChilds, childs ); // int domIndex = 0; - for (Object o : parent.getChildren()) { + for ( Object o : parent.getChildren() ) + { Element elem = (Element) o; Iterator it2 = domChilds.iterator(); Xpp3Dom corrDom = null; - while (it2.hasNext()) { + while ( it2.hasNext() ) + { Xpp3Dom dm = (Xpp3Dom) it2.next(); - if (dm.getName().equals(elem.getName())) { + if ( dm.getName().equals( elem.getName() ) ) + { corrDom = dm; break; } } - if (corrDom != null) { - domChilds.remove(corrDom); - replaceXpp3DOM(elem, corrDom, new Counter(counter.getDepth() + 1)); + if ( corrDom != null ) + { + domChilds.remove( corrDom ); + replaceXpp3DOM( elem, corrDom, new Counter( counter.getDepth() + 1 ) ); counter.increaseCount(); - } else { - parent.removeContent(elem); + } + else + { + parent.removeContent( elem ); } } - for (Object domChild : domChilds) { + for ( Object domChild : domChilds ) + { Xpp3Dom dm = (Xpp3Dom) domChild; - Element elem = factory.element(dm.getName(), parent.getNamespace()); - insertAtPreferredLocation(parent, elem, counter); + Element elem = factory.element( dm.getName(), parent.getNamespace() ); + insertAtPreferredLocation( parent, elem, counter ); counter.increaseCount(); - replaceXpp3DOM(elem, dm, new Counter(counter.getDepth() + 1)); + replaceXpp3DOM( elem, dm, new Counter( counter.getDepth() + 1 ) ); } } else if ( parentDom.getValue() != null ) @@ -1164,42 +1175,6 @@ public class MavenJDOMWriter } // -- void replaceXpp3DOM(Element, Xpp3Dom, Counter) /** - * Method updateActivation - * - * @param value - * @param element - * @param counter - * @param xmlTag - */ - /* - * protected void updateActivation(Activation value, String xmlTag, Counter counter, Element element) { boolean - * shouldExist = value != null; Element root = updateElement(counter, element, xmlTag, shouldExist); if - * (shouldExist) { Counter innerCount = new Counter(counter.getDepth() + 1); findAndReplaceSimpleElement(innerCount, - * root, "activeByDefault", !value.isActiveByDefault() ? null : String.valueOf( value.isActiveByDefault() ), - * "false"); findAndReplaceSimpleElement(innerCount, root, "jdk", value.getJdk(), null); updateActivationOS( - * value.getOs(), "os", innerCount, root); updateActivationProperty( value.getProperty(), "property", innerCount, - * root); updateActivationFile( value.getFile(), "file", innerCount, root); updateActivationCustom( - * value.getCustom(), "custom", innerCount, root); } } //-- void updateActivation(Activation, String, Counter, - * Element) - */ - - /** - * Method updateActivationCustom - * - * @param value - * @param element - * @param counter - * @param xmlTag - */ - /* - * protected void updateActivationCustom(ActivationCustom value, String xmlTag, Counter counter, Element element) { - * boolean shouldExist = value != null; Element root = updateElement(counter, element, xmlTag, shouldExist); if - * (shouldExist) { Counter innerCount = new Counter(counter.getDepth() + 1); findAndReplaceXpp3DOM(innerCount, root, - * "configuration", (Xpp3Dom)value.getConfiguration()); findAndReplaceSimpleElement(innerCount, root, "type", - * value.getType(), null); } } //-- void updateActivationCustom(ActivationCustom, String, Counter, Element) - */ - - /** * Method updateActivationFile * * @param value 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=1642364&r1=1642363&r2=1642364&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 Fri Nov 28 21:33:29 2014 @@ -141,7 +141,7 @@ public class ApacheNoticeResourceTransfo { //resource-bundle 1.3 mode if ( lineCount == 1 - && sb.toString().contains("This product includes/uses software(s) developed by")) + && sb.toString().contains( "This product includes/uses software(s) developed by" ) ) { currentOrg = organizationEntries.get( sb.toString().trim() ); if ( currentOrg == null ) @@ -164,7 +164,7 @@ public class ApacheNoticeResourceTransfo else { String ent = sb.toString(); - if ( ent.startsWith( projectName ) && ent.contains("Copyright ")) + if ( ent.startsWith( projectName ) && ent.contains( "Copyright " ) ) { copyright = ent; } 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=1642364&r1=1642363&r2=1642364&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 Fri Nov 28 21:33:29 2014 @@ -87,40 +87,45 @@ public class ComponentsXmlResourceTransf Xpp3Dom[] children = newDom.getChild( "components" ).getChildren( "component" ); - for (Xpp3Dom component : children) { - String role = getValue(component, "role"); - role = getRelocatedClass(role, relocators); - setValue(component, "role", role); - - String roleHint = getValue(component, "role-hint"); - - String impl = getValue(component, "implementation"); - impl = getRelocatedClass(impl, relocators); - setValue(component, "implementation", impl); + for ( Xpp3Dom component : children ) + { + String role = getValue( component, "role" ); + role = getRelocatedClass( role, relocators ); + setValue( component, "role", role ); + + String roleHint = getValue( component, "role-hint" ); + + String impl = getValue( component, "implementation" ); + impl = getRelocatedClass( impl, relocators ); + setValue( component, "implementation", impl ); String key = role + ':' + roleHint; - if (components.containsKey(key)) { + if ( components.containsKey( key ) ) + { // TODO: use the tools in Plexus to merge these properly. For now, I just need an all-or-nothing // configuration carry over - Xpp3Dom dom = components.get(key); - if (dom.getChild("configuration") != null) { - component.addChild(dom.getChild("configuration")); + Xpp3Dom dom = components.get( key ); + if ( dom.getChild( "configuration" ) != null ) + { + component.addChild( dom.getChild( "configuration" ) ); } } - Xpp3Dom requirements = component.getChild("requirements"); - if (requirements != null && requirements.getChildCount() > 0) { - for (int r = requirements.getChildCount() - 1; r >= 0; r--) { - Xpp3Dom requirement = requirements.getChild(r); - - String requiredRole = getValue(requirement, "role"); - requiredRole = getRelocatedClass(requiredRole, relocators); - setValue(requirement, "role", requiredRole); + Xpp3Dom requirements = component.getChild( "requirements" ); + if ( requirements != null && requirements.getChildCount() > 0 ) + { + for ( int r = requirements.getChildCount() - 1; r >= 0; r-- ) + { + Xpp3Dom requirement = requirements.getChild( r ); + + String requiredRole = getValue( requirement, "role" ); + requiredRole = getRelocatedClass( requiredRole, relocators ); + setValue( requirement, "role", requiredRole ); } } - components.put(key, component); + components.put( key, component ); } } Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/DontIncludeResourceTransformer.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/DontIncludeResourceTransformer.java?rev=1642364&r1=1642363&r2=1642364&view=diff ============================================================================== --- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/DontIncludeResourceTransformer.java (original) +++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/resource/DontIncludeResourceTransformer.java Fri Nov 28 21:33:29 2014 @@ -45,11 +45,11 @@ public class DontIncludeResourceTransfor return true; } - if( resources != null ) + if ( resources != null ) { - for( String resourceEnd : resources ) + for ( String resourceEnd : resources ) { - if( r.endsWith( resourceEnd ) ) + if ( r.endsWith( resourceEnd ) ) { return true; }