[ 
https://issues.apache.org/jira/browse/KARAF-5203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16289592#comment-16289592
 ] 

ASF GitHub Bot commented on KARAF-5203:
---------------------------------------

jbonofre closed pull request #429: [KARAF-5203] Includes conditional bundles 
and configuration files whe…
URL: https://github.com/apache/karaf/pull/429
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/kar/src/main/java/org/apache/karaf/kar/internal/KarServiceImpl.java 
b/kar/src/main/java/org/apache/karaf/kar/internal/KarServiceImpl.java
index ec7e21d34c..f7b6758f67 100644
--- a/kar/src/main/java/org/apache/karaf/kar/internal/KarServiceImpl.java
+++ b/kar/src/main/java/org/apache/karaf/kar/internal/KarServiceImpl.java
@@ -45,12 +45,7 @@
 import java.util.jar.JarOutputStream;
 import java.util.jar.Manifest;
 
-import org.apache.karaf.features.BundleInfo;
-import org.apache.karaf.features.ConfigFileInfo;
-import org.apache.karaf.features.Dependency;
-import org.apache.karaf.features.Feature;
-import org.apache.karaf.features.FeaturesService;
-import org.apache.karaf.features.Repository;
+import org.apache.karaf.features.*;
 import org.apache.karaf.kar.KarService;
 import org.apache.karaf.util.StreamUtils;
 import org.apache.karaf.util.maven.Parser;
@@ -404,14 +399,27 @@ private void closeStream(OutputStream os) {
 
     private void copyFeatureToJar(JarOutputStream jos, Feature feature, 
Map<URI, Integer> locationMap)
         throws URISyntaxException {
+        // add bundles
         for (BundleInfo bundleInfo : feature.getBundles()) {
             URI location = new URI(bundleInfo.getLocation());
             copyResourceToJar(jos, location, locationMap);
         }
+        // add config files
         for (ConfigFileInfo configFileInfo : feature.getConfigurationFiles()) {
             URI location = new URI(configFileInfo.getLocation());
             copyResourceToJar(jos, location, locationMap);
         }
+        // add bundles and config files in conditionals
+        for (Conditional conditional : feature.getConditional()) {
+            for (BundleInfo bundleInfo : conditional.getBundles()) {
+                URI location = new URI(bundleInfo.getLocation());
+                copyResourceToJar(jos, location, locationMap);
+            }
+            for (ConfigFileInfo configFileInfo : 
conditional.getConfigurationFiles()) {
+                URI location = new URI(configFileInfo.getLocation());
+                copyResourceToJar(jos, location, locationMap);
+            }
+        }
     }
 
     private void copyResourceToJar(JarOutputStream jos, URI location, Map<URI, 
Integer> locationMap) {


 

----------------------------------------------------------------
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


> KAR:Create missing bundles that are marked conditional
> ------------------------------------------------------
>
>                 Key: KARAF-5203
>                 URL: https://issues.apache.org/jira/browse/KARAF-5203
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-kar
>         Environment: N/A
>            Reporter: George McCone
>            Assignee: Jean-Baptiste Onofré
>            Priority: Minor
>             Fix For: 4.1.4, 4.2.0
>
>
> When creating a KAR file using the KAR:CREATE commands for a feature contains 
> a <conditional> bundle in the feature file, the bundle is not being included 
> in the resulting KAR.
> I found this while creating a KAR for aries-rsa using the following command.
> >kar:create aries-rsa-1.9.0 aries-rsa-discovery-zookeeper
> When trying to start the KAR, I received errors stating that it could not 
> find the mvn:org.apache.aries.rsa/org.apache.aries.rsa.eapub/1.9.0 from the 
> repository. Checking the KAR, this bundle was not present. I manually updated 
> the KAR and the feature started successfully.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to