diff --git a/pom.xml b/pom.xml index d7493a27..d0012eee 100644 --- a/pom.xml +++ b/pom.xml @@ -185,10 +185,14 @@ under the License. 3.4.2 test + org.apache.maven.shared maven-shared-jar - 3.0.0 + 3.1.0 org.apache.maven.resolver @@ -516,6 +520,37 @@ under the License. + + org.codehaus.mojo + mrm-maven-plugin + 1.6.0 + + repository.proxy.url + + + src/it/mrm/repository + + ${project.build.directory}/local-repo + + + + ${project.build.directory}/local-repo + + + + + + + + start + stop + + + + diff --git a/src/it/MPIR-455/invoker.properties b/src/it/MPIR-455/invoker.properties new file mode 100644 index 00000000..277d7d1e --- /dev/null +++ b/src/it/MPIR-455/invoker.properties @@ -0,0 +1,20 @@ +# 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. + +# Remove with next major version +invoker.mavenOpts = -Duser.language=en +invoker.goals = ${project.groupId}:${project.artifactId}:${project.version}:dependencies diff --git a/src/it/MPIR-455/pom.xml b/src/it/MPIR-455/pom.xml new file mode 100644 index 00000000..82550735 --- /dev/null +++ b/src/it/MPIR-455/pom.xml @@ -0,0 +1,87 @@ + + + + + 4.0.0 + + org.apache.maven.plugins.project-info-reports.its + MPIR-455 + 1.0-SNAPSHOT + pom + http://maven.apache.org/plugins/it/${project.artifactId} + + + UTF-8 + UTF-8 + + + + + + org.apache.maven.its.mpir-455 + multi-release-test + 0.0.1 + test + + + org.codehaus.plexus + plexus-utils + 4.0.0 + + + org.apache.maven.its.mpir-455 + module-info-only-test + 0.0.1 + runtime + + + + + + + + org.apache.maven.plugins + maven-site-plugin + @sitePluginVersion@ + + + + + + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + @project.version@ + + + + dependencies + + + + + + + + diff --git a/src/it/MPIR-455/verify.groovy b/src/it/MPIR-455/verify.groovy new file mode 100644 index 00000000..eb695dfd --- /dev/null +++ b/src/it/MPIR-455/verify.groovy @@ -0,0 +1,119 @@ +/* + * 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. + */ +String html = new File( basedir, 'target/site/dependencies.html' ).text.normalize() + +def summaryLine = '''\ + +module-info-only-test-0.0.1.jar +3.3 kB +10 +- +- +- +- + +   • Root +- +9 +0 +0 +- +- + +   • Versioned +- +1 +1 +1 +11 +No + +multi-release-test-0.0.1.jar +10.2 kB +37 +- +- +- +- + +   • Root +- +19 +1 +1 +1.8 +Yes + +   • Versioned +- +9 +1 +1 +9 +Yes + +   • Versioned +- +9 +1 +1 +11 +Yes + +plexus-utils-4.0.0.jar +192.4 kB +128 +- +- +- +- + +   • Root +- +113 +86 +7 +1.8 +Yes + +   • Versioned +- +5 +1 +1 +9 +Yes + +   • Versioned +- +5 +1 +1 +10 +Yes + +   • Versioned +- +5 +1 +1 +11 +Yes''' + +assert html.contains( summaryLine.normalize() ) diff --git a/src/it/mrm/repository/org/apache/maven/its/mpir-455/module-info-only-test/0.0.1/module-info-only-test-0.0.1.jar b/src/it/mrm/repository/org/apache/maven/its/mpir-455/module-info-only-test/0.0.1/module-info-only-test-0.0.1.jar new file mode 100644 index 00000000..c6f5752f Binary files /dev/null and b/src/it/mrm/repository/org/apache/maven/its/mpir-455/module-info-only-test/0.0.1/module-info-only-test-0.0.1.jar differ diff --git a/src/it/mrm/repository/org/apache/maven/its/mpir-455/module-info-only-test/0.0.1/module-info-only-test-0.0.1.pom b/src/it/mrm/repository/org/apache/maven/its/mpir-455/module-info-only-test/0.0.1/module-info-only-test-0.0.1.pom new file mode 100644 index 00000000..95e0eaf8 --- /dev/null +++ b/src/it/mrm/repository/org/apache/maven/its/mpir-455/module-info-only-test/0.0.1/module-info-only-test-0.0.1.pom @@ -0,0 +1,31 @@ + + + + + 4.0.0 + + org.apache.maven.its.mpir-455 + module-info-only-test + 0.0.1 + + module-info-only-test + diff --git a/src/it/mrm/repository/org/apache/maven/its/mpir-455/multi-release-test/0.0.1/multi-release-test-0.0.1.jar b/src/it/mrm/repository/org/apache/maven/its/mpir-455/multi-release-test/0.0.1/multi-release-test-0.0.1.jar new file mode 100644 index 00000000..b0a03bc1 Binary files /dev/null and b/src/it/mrm/repository/org/apache/maven/its/mpir-455/multi-release-test/0.0.1/multi-release-test-0.0.1.jar differ diff --git a/src/it/mrm/repository/org/apache/maven/its/mpir-455/multi-release-test/0.0.1/multi-release-test-0.0.1.pom b/src/it/mrm/repository/org/apache/maven/its/mpir-455/multi-release-test/0.0.1/multi-release-test-0.0.1.pom new file mode 100644 index 00000000..8535ce91 --- /dev/null +++ b/src/it/mrm/repository/org/apache/maven/its/mpir-455/multi-release-test/0.0.1/multi-release-test-0.0.1.pom @@ -0,0 +1,33 @@ + + + + + 4.0.0 + + org.apache.maven.its.mpir-455 + multi-release-test + 0.0.1 + jar + + multi-release-test + + diff --git a/src/it/settings.xml b/src/it/settings.xml index 278bff2c..2977a4fc 100644 --- a/src/it/settings.xml +++ b/src/it/settings.xml @@ -28,6 +28,20 @@ under the License. true + + snapshots + @repository.proxy.url@ + + true + ignore + never + + + true + ignore + always + + local.central @localRepositoryUrl@ diff --git a/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java b/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java index 4981acc1..81d81281 100644 --- a/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java +++ b/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java @@ -29,6 +29,7 @@ import java.text.FieldPosition; import java.text.MessageFormat; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; @@ -62,6 +63,9 @@ import org.apache.maven.repository.RepositorySystem; import org.apache.maven.shared.dependency.graph.DependencyNode; import org.apache.maven.shared.jar.JarData; +import org.apache.maven.shared.jar.classes.JarClasses; +import org.apache.maven.shared.jar.classes.JarVersionedRuntime; +import org.apache.maven.shared.jar.classes.JarVersionedRuntimes; import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolverException; import org.codehaus.plexus.i18n.I18N; import org.codehaus.plexus.util.StringUtils; @@ -591,16 +595,76 @@ private void renderSectionDependencyFileDetails() { fileLength = "-"; } - tableRow(hasSealed, new String[] { - name, - fileLength, - String.valueOf(jarDetails.getNumEntries()), - String.valueOf(jarDetails.getNumClasses()), - String.valueOf(jarDetails.getNumPackages()), - jdkRevisionCellValue, - debugInformationCellValue, - sealedCellValue - }); + if (jarDetails.isMultiRelease()) { + String htmlBullet = "   • "; + String rootTag = htmlBullet + getI18nString("file.details.multirelease.root"); + String versionedTag = htmlBullet + getI18nString("file.details.multirelease.versioned"); + + // general jar information row + tableRow(hasSealed, new String[] { + name, + fileLength, + String.valueOf(jarDetails.getNumEntries()), + "", + "", + "", + "", + sealedCellValue + }); + + JarVersionedRuntimes versionedRuntimes = jarDetails.getVersionedRuntimes(); + Collection versionedRuntimeList = + versionedRuntimes.getVersionedRuntimeMap().values(); + + // workaround to count the number of root content entries + // TODO: rework this when MSHARED-1411 is fixed + Integer versionedNumEntries = versionedRuntimeList.stream() + .map(versionedRuntime -> + versionedRuntime.getEntries().size()) + .reduce(0, Integer::sum); + Integer rootContentNumEntries = jarDetails.getNumEntries() - versionedNumEntries; + + // root content information row + tableRow(hasSealed, new String[] { + rootTag, + "", + String.valueOf(rootContentNumEntries), + String.valueOf(jarDetails.getNumClasses()), + String.valueOf(jarDetails.getNumPackages()), + jdkRevisionCellValue, + debugInformationCellValue, + "" + }); + + for (JarVersionedRuntime versionedRuntime : versionedRuntimeList) { + JarClasses rtJarClasses = versionedRuntime.getJarClasses(); + + debugInformationCellValue = + rtJarClasses.isDebugPresent() ? debugInformationCellYes : debugInformationCellNo; + + tableRow(hasSealed, new String[] { + versionedTag, + "", + String.valueOf(versionedRuntime.getEntries().size()), + String.valueOf(rtJarClasses.getClassNames().size()), + String.valueOf(rtJarClasses.getPackages().size()), + rtJarClasses.getJdkRevision(), + debugInformationCellValue, + "" + }); + } + } else { + tableRow(hasSealed, new String[] { + name, + fileLength, + String.valueOf(jarDetails.getNumEntries()), + String.valueOf(jarDetails.getNumClasses()), + String.valueOf(jarDetails.getNumPackages()), + jdkRevisionCellValue, + debugInformationCellValue, + sealedCellValue + }); + } } catch (IOException e) { createExceptionInfoTableRow(artifact, artifactFile, e, hasSealed); } diff --git a/src/main/resources/project-info-reports.properties b/src/main/resources/project-info-reports.properties index 2845c90e..c8e9c7c8 100644 --- a/src/main/resources/project-info-reports.properties +++ b/src/main/resources/project-info-reports.properties @@ -69,6 +69,8 @@ report.dependencies.file.details.column.size.gb = GB report.dependencies.file.details.column.size.mb = MB report.dependencies.file.details.column.size.kb = kB report.dependencies.file.details.columntitle.debuginformation = Indicates whether these dependencies have been compiled with debug information. +report.dependencies.file.details.multirelease.root = Root +report.dependencies.file.details.multirelease.versioned = Versioned report.dependencies.file.details.title = Dependency File Details report.dependencies.file.details.total = Total report.dependencies.graph.icon.close = [Close] diff --git a/src/main/resources/project-info-reports_de.properties b/src/main/resources/project-info-reports_de.properties index 54bd9898..e14e0c35 100644 --- a/src/main/resources/project-info-reports_de.properties +++ b/src/main/resources/project-info-reports_de.properties @@ -69,6 +69,8 @@ report.dependencies.file.details.column.size.gb = GB report.dependencies.file.details.column.size.mb = MB report.dependencies.file.details.column.size.kb = kB report.dependencies.file.details.columntitle.debuginformation = Gibt an, ob diese Abhängigkeiten mit Debug-Informationen kompiliert wurden. +report.dependencies.file.details.multirelease.root = Wurzel +report.dependencies.file.details.multirelease.versioned = Versioniert report.dependencies.file.details.title = Details zu den Abh\u00e4ngigkeiten report.dependencies.file.details.total = Gesamt report.dependencies.graph.icon.close = [schlie\u00dfen] diff --git a/src/main/resources/project-info-reports_es.properties b/src/main/resources/project-info-reports_es.properties index ccbe75da..00c143c5 100644 --- a/src/main/resources/project-info-reports_es.properties +++ b/src/main/resources/project-info-reports_es.properties @@ -67,6 +67,8 @@ report.dependencies.file.details.column.size = Tama\u00f1o report.dependencies.file.details.column.size.gb = GB report.dependencies.file.details.column.size.mb = MB report.dependencies.file.details.column.size.kb = kB +report.dependencies.file.details.multirelease.root = Ra\u00edz +report.dependencies.file.details.multirelease.versioned = Versionado report.dependencies.file.details.title = Detalles del Fichero report.dependencies.file.details.total = Total report.dependencies.graph.tables.licenses = Licencias