[GitHub] rfscholte commented on a change in pull request #7: [MPIR-375] add plugin excludes feature for plugin-management report
rfscholte commented on a change in pull request #7: [MPIR-375] add plugin excludes feature for plugin-management report URL: https://github.com/apache/maven-project-info-reports-plugin/pull/7#discussion_r247358087 ## File path: src/main/java/org/apache/maven/report/projectinfo/PluginManagementReport.java ## @@ -255,5 +283,41 @@ public int compare( Plugin a1, Plugin a2 ) } }; } + +private boolean isExcluded( Artifact pluginArtifact ) +{ +if ( excludes == null ) +{ +return false; +} + +for ( String pattern : excludes ) +{ +String[] subStrings = pattern.split( ":" ); Review comment: I don't see a reason to cleanup the pattern. This is already a list, not a single comma-separated String. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] rfscholte commented on a change in pull request #7: [MPIR-375] add plugin excludes feature for plugin-management report
rfscholte commented on a change in pull request #7: [MPIR-375] add plugin excludes feature for plugin-management report URL: https://github.com/apache/maven-project-info-reports-plugin/pull/7#discussion_r247357917 ## File path: src/main/java/org/apache/maven/report/projectinfo/PluginManagementReport.java ## @@ -200,13 +220,21 @@ private void renderSectionPluginManagement() Artifact pluginArtifact = repositorySystem.createProjectArtifact( plugin.getGroupId(), plugin .getArtifactId(), versionRange.toString() ); - + try { -MavenProject pluginProject = projectBuilder.build( pluginArtifact, buildingRequest ).getProject(); - -tableRow( getPluginRow( pluginProject.getGroupId(), pluginProject.getArtifactId(), pluginProject -.getVersion(), pluginProject.getUrl() ) ); +if ( isExcluded( pluginArtifact ) ) +{ +log.debug( "Excluding plugin " + pluginArtifact.getId() + " from report" ); +} +else +{ +MavenProject pluginProject = Review comment: Can you the try-catch statement inside the else-statement, not around the whole if-else statement This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] rfscholte commented on a change in pull request #7: [MPIR-375] add plugin excludes feature for plugin-management report
rfscholte commented on a change in pull request #7: [MPIR-375] add plugin excludes feature for plugin-management report URL: https://github.com/apache/maven-project-info-reports-plugin/pull/7#discussion_r247358442 ## File path: src/test/resources/plugin-configs/plugin-management-plugin-config-MPIR-375.xml ## @@ -0,0 +1,89 @@ + + +http://maven.apache.org/POM/4.0.0; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd;> + 4.0.0 + org.apache.maven.plugin.projectinfo.tests + plugin-management + 1.0-SNAPSHOT + jar + plugin management project info + Review comment: Try to remove all unrequired stuff, like dependencies This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] rfscholte commented on a change in pull request #7: [MPIR-375] add plugin excludes feature for plugin-management report
rfscholte commented on a change in pull request #7: [MPIR-375] add plugin excludes feature for plugin-management report URL: https://github.com/apache/maven-project-info-reports-plugin/pull/7#discussion_r247358392 ## File path: src/main/java/org/apache/maven/report/projectinfo/PluginManagementReport.java ## @@ -255,5 +283,41 @@ public int compare( Plugin a1, Plugin a2 ) } }; } + +private boolean isExcluded( Artifact pluginArtifact ) +{ +if ( excludes == null ) +{ +return false; +} + +for ( String pattern : excludes ) +{ +String[] subStrings = pattern.split( ":" ); +subStrings = StringUtils.stripAll( subStrings ); +String resultPattern = StringUtils.join( subStrings, ":" ); + +if ( compareDependency( resultPattern, pluginArtifact ) ) +{ +return true; +} +} + +return false; +} + +/** + * Compares the given pattern against the given artifact. The pattern should follow the format + * groupId:artifactId:type:classifier:version. + * + * @param pattern The pattern to compare the artifact with. + * @param artifact the artifact + * @return true if the artifact matches the pattern + */ +protected boolean compareDependency( String pattern, Artifact artifact ) +{ Review comment: Use org.apache.maven.shared.artifact.filter.PatternExcludesArtifactFilter instead This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] rfscholte commented on a change in pull request #7: [MPIR-375] add plugin excludes feature for plugin-management report
rfscholte commented on a change in pull request #7: [MPIR-375] add plugin excludes feature for plugin-management report URL: https://github.com/apache/maven-project-info-reports-plugin/pull/7#discussion_r247357835 ## File path: src/it/MPIR-375/pom.xml ## @@ -0,0 +1,125 @@ + + + +http://maven.apache.org/POM/4.0.0; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd;> + 4.0.0 + + org.apache.maven.plugins.project-info-reports.its + MPIR-375 + 1.0-SNAPSHOT + jar + http://maven.apache.org/plugins/it/${project.artifactId} + + +1.7 +1.7 +UTF-8 +UTF-8 + + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + +org.codehaus.mojo +keytool-maven-plugin +[1.5,) + + clean + + + + + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.0.1 + + + + + + +org.apache.maven.plugins +maven-site-plugin +@sitePluginVersion@ + + + Review comment: Can you remove this plugin, I don't see the need for it in this IT This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services