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().trim()); copyResourceToJar(jos, location, locationMap); } // add config files for (ConfigFileInfo configFileInfo : feature.getConfigurationFiles()) { URI location = new URI(configFileInfo.getLocation().trim()); 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().trim()); copyResourceToJar(jos, location, locationMap); } for (ConfigFileInfo configFileInfo : conditional.getConfigurationFiles()) { URI location = new URI(configFileInfo.getLocation().trim()); copyResourceToJar(jos, location, locationMap); } } }
/** * Read bundles and configuration files in the features file. * * @return * @throws MojoExecutionException */ private List<Artifact> readResources(File featuresFile) throws MojoExecutionException { List<Artifact> resources = new ArrayList<>(); try { Features features = JaxbUtil.unmarshal(featuresFile.toURI().toASCIIString(), false); for (Feature feature : features.getFeature()) { for (BundleInfo bundle : feature.getBundles()) { if (ignoreDependencyFlag || (!ignoreDependencyFlag && !bundle.isDependency())) { resources.add(resourceToArtifact(bundle.getLocation(), false)); } } for (ConfigFileInfo configFile : feature.getConfigurationFiles()) { resources.add(resourceToArtifact(configFile.getLocation(), false)); } } return resources; } catch (MojoExecutionException e) { throw e; } catch (Exception e) { throw new MojoExecutionException("Could not interpret features.xml", e); } }
/** * Read bundles and configuration files in the features file. * * @return * @throws MojoExecutionException */ private List<Artifact> readResources(File featuresFile) throws MojoExecutionException { List<Artifact> resources = new ArrayList<>(); try { Features features = JaxbUtil.unmarshal(featuresFile.toURI().toASCIIString(), false); for (Feature feature : features.getFeature()) { for (BundleInfo bundle : feature.getBundles()) { if (ignoreDependencyFlag || (!ignoreDependencyFlag && !bundle.isDependency())) { resources.add(resourceToArtifact(bundle.getLocation(), false)); } } for (ConfigFileInfo configFile : feature.getConfigurationFiles()) { resources.add(resourceToArtifact(configFile.getLocation(), false)); } } return resources; } catch (MojoExecutionException e) { throw e; } catch (Exception e) { throw new MojoExecutionException("Could not interpret features.xml", e); } }
installConfigurationFile(configFile.getLocation(), configFile.getFinalname(), configFile.isOverride());