diff options
Diffstat (limited to 'bundle-plugin')
-rw-r--r-- | bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateOsgiManifestMojo.java | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateOsgiManifestMojo.java b/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateOsgiManifestMojo.java index 685cda66a16..04f2428d284 100644 --- a/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateOsgiManifestMojo.java +++ b/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateOsgiManifestMojo.java @@ -122,6 +122,7 @@ public class GenerateOsgiManifestMojo extends AbstractMojo { getLog().warn("This project does not have jdisc_core as provided dependency, so the " + "generated 'Import-Package' OSGi header may be missing important packages."); } + logOverlappingPackages(projectPackages, exportedPackagesFromProvidedDeps); logUnnecessaryPackages(compileJarsPackages, exportedPackagesFromProvidedDeps); Map<String, Import> calculatedImports = calculateImports(includedPackages.referencedPackages(), @@ -141,20 +142,6 @@ public class GenerateOsgiManifestMojo extends AbstractMojo { } } - /** - * This mostly detects packages re-exported via composite bundles like jdisc_core and container-disc. - * An artifact can only be represented once, either in compile or provided scope. So if the project - * adds an artifact in compile scope that we deploy as a pre-installed bundle, we won't see the same - * artifact as provided via container-dev and hence can't detect the duplicate packages. - */ - private void logUnnecessaryPackages(PackageTally compileJarsPackages, Set<String> exportedPackagesFromProvidedDeps) { - Set<String> unnecessaryPackages = Sets.intersection(compileJarsPackages.definedPackages(), exportedPackagesFromProvidedDeps); - if (! unnecessaryPackages.isEmpty()) { - getLog().info("Compile scoped jars contain the following packages that are most likely " + - "available from jdisc runtime: " + unnecessaryPackages); - } - } - private void logDebugPackageSets(AnalyzeBundle.PublicPackages publicPackagesFromProvidedJars, PackageTally includedPackages) { if (getLog().isDebugEnabled()) { getLog().debug("Referenced packages = " + includedPackages.referencedPackages()); @@ -188,6 +175,30 @@ public class GenerateOsgiManifestMojo extends AbstractMojo { } } + private void logOverlappingPackages(PackageTally projectPackages, + Set<String> exportedPackagesFromProvidedDeps) { + Set<String> overlappingProjectPackages = Sets.intersection(projectPackages.definedPackages(), exportedPackagesFromProvidedDeps); + if (! overlappingProjectPackages.isEmpty()) { + getLog().warn("Project classes use the following packages that are already defined in provided scoped dependencies: " + + overlappingProjectPackages); + } + } + + /* + * This mostly detects packages re-exported via composite bundles like jdisc_core and container-disc. + * An artifact can only be represented once, either in compile or provided scope. So if the project + * adds an artifact in compile scope that we deploy as a pre-installed bundle, we won't see the same + * artifact as provided via container-dev and hence can't detect the duplicate packages. + */ + private void logUnnecessaryPackages(PackageTally compileJarsPackages, + Set<String> exportedPackagesFromProvidedDeps) { + Set<String> unnecessaryPackages = Sets.intersection(compileJarsPackages.definedPackages(), exportedPackagesFromProvidedDeps); + if (! unnecessaryPackages.isEmpty()) { + getLog().info("Compile scoped jars contain the following packages that are most likely " + + "available from jdisc runtime: " + unnecessaryPackages); + } + } + private static void warnIfPackagesDefinedOverlapsGlobalPackages(Set<String> internalPackages, List<String> globalPackages) throws MojoExecutionException { Set<String> overlap = Sets.intersection(internalPackages, new HashSet<>(globalPackages)); |