diff options
Diffstat (limited to 'bundle-plugin/src/main/java/com/yahoo/container')
-rw-r--r-- | bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateOsgiManifestMojo.java | 12 | ||||
-rw-r--r-- | bundle-plugin/src/main/java/com/yahoo/container/plugin/util/Artifacts.java | 4 |
2 files changed, 14 insertions, 2 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 814a9667e8a..e20b42da4e6 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 @@ -134,7 +134,7 @@ public class GenerateOsgiManifestMojo extends AbstractGenerateOsgiManifestMojo { Map<String, String> manifestContent = generateManifestContent(artifactSet.getJarArtifactsToInclude(), calculatedImports, includedPackages); addAdditionalManifestProperties(manifestContent); - addManifestPropertiesForInternalBundles(manifestContent, includedPackages); + addManifestPropertiesForInternalAndCoreBundles(manifestContent, includedPackages, providedJarArtifacts); addManifestPropertiesForUserBundles(manifestContent, jdiscCore, nonPublicApiUsed); createManifestFile(Paths.get(project.getBuild().getOutputDirectory()), manifestContent); @@ -160,13 +160,21 @@ public class GenerateOsgiManifestMojo extends AbstractGenerateOsgiManifestMojo { addIfNotEmpty(manifestContent, "WebInfUrl", webInfUrl); } - private void addManifestPropertiesForInternalBundles(Map<String, String> manifestContent, PackageTally includedPackages) { + private void addManifestPropertiesForInternalAndCoreBundles(Map<String, String> manifestContent, + PackageTally includedPackages, + List<Artifact> providedJarArtifacts) { if (effectiveBundleType() == BundleType.USER) return; // TODO: this attribute is not necessary, remove? addIfNotEmpty(manifestContent, "X-JDisc-PublicApi-Package", publicApi(includedPackages)); addIfNotEmpty(manifestContent, "X-JDisc-Non-PublicApi-Export-Package", nonPublicApi(includedPackages)); + + if (effectiveBundleType() == BundleType.CORE) { + addIfNotEmpty(manifestContent, "X-JDisc-Provided-Artifact", providedJarArtifacts.stream() + .map(Artifacts::idAndVersion) + .collect(Collectors.joining(","))); + } } private void addManifestPropertiesForUserBundles(Map<String, String> manifestContent, diff --git a/bundle-plugin/src/main/java/com/yahoo/container/plugin/util/Artifacts.java b/bundle-plugin/src/main/java/com/yahoo/container/plugin/util/Artifacts.java index bde0c124229..2bbdece06ac 100644 --- a/bundle-plugin/src/main/java/com/yahoo/container/plugin/util/Artifacts.java +++ b/bundle-plugin/src/main/java/com/yahoo/container/plugin/util/Artifacts.java @@ -49,6 +49,10 @@ public class Artifacts { } } + public static String idAndVersion(Artifact artifact) { + return artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion(); + } + public static ArtifactSet getArtifacts(MavenProject project) { return getArtifacts(project, new NoopScopeTranslator()); } public static ArtifactSet getArtifacts(MavenProject project, ScopeTranslator scopeTranslator) { |