diff --git a/liberty-maven-plugin/src/it/ear-project-it/AppXmlEAR/src/test/java/net/wasdev/wlp/maven/test/it/LooseConfigTestIT.java b/liberty-maven-plugin/src/it/ear-project-it/AppXmlEAR/src/test/java/net/wasdev/wlp/maven/test/it/LooseConfigTestIT.java
index f57090c72..6c3556461 100644
--- a/liberty-maven-plugin/src/it/ear-project-it/AppXmlEAR/src/test/java/net/wasdev/wlp/maven/test/it/LooseConfigTestIT.java
+++ b/liberty-maven-plugin/src/it/ear-project-it/AppXmlEAR/src/test/java/net/wasdev/wlp/maven/test/it/LooseConfigTestIT.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * (c) Copyright IBM Corporation 2017.
+ * (c) Copyright IBM Corporation 2017, 2023.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -65,5 +65,20 @@ public void testLooseApplicationFileContent() throws Exception {
File appXml = new File("../src/main/application/META-INF/application.xml");
assertEquals("file sourceOnDisk attribute value", appXml.getCanonicalPath(),
nodes.item(0).getAttributes().getNamedItem("sourceOnDisk").getNodeValue());
+
+ expression = "/archive/archive/archive";
+ nodes = (NodeList) xPath.compile(expression).evaluate(inputDoc, XPathConstants.NODESET);
+ assertEquals("Number of element ==>", 1, nodes.getLength());
+ assertEquals("archive targetInArchive attribute value", "/WEB-INF/lib/SampleBundle-1.0-SNAPSHOT.jar",
+ nodes.item(0).getAttributes().getNamedItem("targetInArchive").getNodeValue());
+
+ expression = "/archive/archive/archive/dir";
+ nodes = (NodeList) xPath.compile(expression).evaluate(inputDoc, XPathConstants.NODESET);
+ assertEquals("Number of
element ==>", 1, nodes.getLength());
+
+ expression = "/archive/archive/archive/file";
+ nodes = (NodeList) xPath.compile(expression).evaluate(inputDoc, XPathConstants.NODESET);
+ assertEquals("Number of element ==>", 1, nodes.getLength());
+
}
}
diff --git a/liberty-maven-plugin/src/it/ear-project-it/SampleBundle/pom.xml b/liberty-maven-plugin/src/it/ear-project-it/SampleBundle/pom.xml
new file mode 100644
index 000000000..acf96e853
--- /dev/null
+++ b/liberty-maven-plugin/src/it/ear-project-it/SampleBundle/pom.xml
@@ -0,0 +1,51 @@
+
+
+ 4.0.0
+
+
+ io.openliberty.tools.it
+ ear-project-it
+ 1.0-SNAPSHOT
+
+
+ SampleBundle
+ bundle
+
+ ear-project-it: SampleBundle Module
+
+
+
+ javax
+ javaee-api
+
+
+
+
+ junit
+ junit
+
+
+
+
+
+
+ org.apache.felix
+ maven-bundle-plugin
+ true
+
+
+ io.openliberty.tools.it
+ wasdev.sample.bundle*;version=${project.version}
+
+ *
+
+ <_removeheaders>Bnd-LastModified
+ <_reproducible>true
+
+
+
+
+
+
+
diff --git a/liberty-maven-plugin/src/it/ear-project-it/SampleBundle/src/main/java/wasdev/sample/bundle/SampleBundle.java b/liberty-maven-plugin/src/it/ear-project-it/SampleBundle/src/main/java/wasdev/sample/bundle/SampleBundle.java
new file mode 100644
index 000000000..5730e613f
--- /dev/null
+++ b/liberty-maven-plugin/src/it/ear-project-it/SampleBundle/src/main/java/wasdev/sample/bundle/SampleBundle.java
@@ -0,0 +1,9 @@
+
+package wasdev.sample.bundle;
+
+public class SampleBundle {
+
+ public String hello() {
+ return "Hello Bundle World.";
+ }
+}
diff --git a/liberty-maven-plugin/src/it/ear-project-it/SampleWAR/pom.xml b/liberty-maven-plugin/src/it/ear-project-it/SampleWAR/pom.xml
index 68fdf92c6..c1edba40a 100644
--- a/liberty-maven-plugin/src/it/ear-project-it/SampleWAR/pom.xml
+++ b/liberty-maven-plugin/src/it/ear-project-it/SampleWAR/pom.xml
@@ -30,6 +30,11 @@
1.0-SNAPSHOT
provided
+
+ io.openliberty.tools.it
+ SampleBundle
+ 1.0-SNAPSHOT
+
diff --git a/liberty-maven-plugin/src/it/ear-project-it/pom.xml b/liberty-maven-plugin/src/it/ear-project-it/pom.xml
index 2f82ae44d..b3ba0caca 100644
--- a/liberty-maven-plugin/src/it/ear-project-it/pom.xml
+++ b/liberty-maven-plugin/src/it/ear-project-it/pom.xml
@@ -14,6 +14,7 @@
SampleEJB
+ SampleBundle
SampleWAR
SampleWAR2
AppXmlEAR
@@ -70,6 +71,11 @@
maven-ejb-plugin
3.2.1
+
+ org.apache.felix
+ maven-bundle-plugin
+ 5.1.8
+
org.apache.maven.plugins
maven-ear-plugin
diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojoSupport.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojoSupport.java
index 5815459a0..b8a0b4bc0 100644
--- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojoSupport.java
+++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojoSupport.java
@@ -235,6 +235,9 @@ protected void installLooseConfigEar(MavenProject proj, LooseConfigData config,
case "ejb":
looseEar.addEjbModule(dependencyProject, artifact);
break;
+ case "bundle":
+ looseEar.addBundleModule(dependencyProject, artifact);
+ break;
case "war":
Element warArchive = looseEar.addWarModule(dependencyProject, artifact,
getWarSourceDirectory(dependencyProject));
diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/LooseEarApplication.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/LooseEarApplication.java
index f56e77e45..4285b4767 100644
--- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/LooseEarApplication.java
+++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/LooseEarApplication.java
@@ -75,6 +75,10 @@ public Element addEjbModule(MavenProject proj, Artifact artifact) throws MojoExe
return addModule(proj, artifact, "maven-ejb-plugin");
}
+ public Element addBundleModule(MavenProject proj, Artifact artifact) throws MojoExecutionException, IOException {
+ return addModule(proj, artifact, "maven-bundle-plugin");
+ }
+
public Element addModule(MavenProject proj, Artifact artifact, String pluginId) throws MojoExecutionException, IOException {
File outputDirectory = new File(proj.getBuild().getOutputDirectory());
Element moduleArchive = config.addArchive(getModuleUri(artifact));
diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/RunServerMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/RunServerMojo.java
index 2d7a0d057..9cb34a58b 100644
--- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/RunServerMojo.java
+++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/RunServerMojo.java
@@ -107,6 +107,9 @@ private void doRunServer() throws MojoExecutionException {
case "ejb":
runMojo("org.apache.maven.plugins", "maven-ejb-plugin", "ejb");
break;
+ case "bundle":
+ runMojo("org.apache.felix", "maven-bundle-plugin", "bundle");
+ break;
case "jar":
runMojo("org.apache.maven.plugins", "maven-jar-plugin", "jar");
break;
diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/utils/ExecuteMojoUtil.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/utils/ExecuteMojoUtil.java
index f45857b03..2627503b3 100644
--- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/utils/ExecuteMojoUtil.java
+++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/utils/ExecuteMojoUtil.java
@@ -165,6 +165,13 @@ public class ExecuteMojoUtil {
"clientIncludes", "ejbJar", "ejbVersion", "escapeBackslashesInFilePath", "escapeString", "excludes",
"filterDeploymentDescriptor", "filters", "generateClient", "outputTimestamp"));
+ // https://felix.apache.org/documentation/_attachments/components/bundle-plugin/bundle-mojo.html
+ private static final ArrayList BUNDLE_PARAMS = new ArrayList<>(
+ Arrays.asList("archive", "buildDirectory", "classifier", "createDependencyReducedPom", "dependencyReducedPomLocation",
+ "dumpClasspath", "dumpInstructions", "excludeDependencies", "exportScr", "finalName", "instructions",
+ "manifestLocation", "niceManifest", "noWarningProjectTypes", "outputDirectory", "packaging", "scrLocation",
+ "supportedProjectTypes", "unpackbundle"));
+
// https://maven.apache.org/plugins/maven-war-plugin/war-mojo.html
private static final ArrayList WAR_PARAMS = new ArrayList<>(Arrays.asList("outputDirectory",
"warSourceDirectory", "webappDirectory", "workDirectory", "archive", "archiveClasses", "attachClasses",
@@ -350,6 +357,9 @@ private static Xpp3Dom validateConfiguration(Plugin plugin, String goal, Xpp3Dom
case "maven-ejb-plugin:ejb":
goalConfig = stripConfigElements(config, EJB_PARAMS);
break;
+ case "maven-bundle-plugin:bundle":
+ goalConfig = stripConfigElements(config, BUNDLE_PARAMS);
+ break;
case "maven-war-plugin:war":
goalConfig = stripConfigElements(config, WAR_PARAMS);
break;
diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/utils/MavenProjectUtil.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/utils/MavenProjectUtil.java
index ce73be396..a18899daa 100644
--- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/utils/MavenProjectUtil.java
+++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/utils/MavenProjectUtil.java
@@ -175,7 +175,8 @@ public static PluginExecution getPluginGoalExecution(MavenProject project, Strin
* @return the manifest file
*/
public static File getManifestFile(MavenProject proj, String pluginArtifactId) {
- Xpp3Dom dom = proj.getGoalConfiguration("org.apache.maven.plugins", pluginArtifactId, null, null);
+ String groupId = pluginArtifactId.equals("maven-bundle-plugin") ? "org.apache.felix" : "org.apache.maven.plugins";
+ Xpp3Dom dom = proj.getGoalConfiguration(groupId, pluginArtifactId, null, null);
if (dom != null) {
Xpp3Dom archive = dom.getChild("archive");
if (archive != null) {
@@ -185,6 +186,16 @@ public static File getManifestFile(MavenProject proj, String pluginArtifactId) {
}
}
}
+
+ if (pluginArtifactId.equals("maven-bundle-plugin")) {
+ // check for generated manifest file in target/classes/META-INF
+ String dependProjectTargetDir = proj.getBuild().getDirectory();
+ File generatedManifest = new File(dependProjectTargetDir, "/classes/META-INF/MANIFEST.MF");
+ if (generatedManifest.exists()) {
+ return generatedManifest;
+ }
+ }
+
return null;
}