karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject git commit: [KARAF-2732] Include feature inner repository in assembly
Date Sat, 01 Mar 2014 07:58:35 GMT
Repository: karaf
Updated Branches:
  refs/heads/karaf-3.0.x 64dcaf59a -> eee1df647


[KARAF-2732] Include feature inner repository in assembly


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/eee1df64
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/eee1df64
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/eee1df64

Branch: refs/heads/karaf-3.0.x
Commit: eee1df647d424e1afad8c71e584db9821e05b0d0
Parents: 64dcaf5
Author: Jean-Baptiste Onofré <jbonofre@apache.org>
Authored: Sat Mar 1 08:56:53 2014 +0100
Committer: Jean-Baptiste Onofré <jbonofre@apache.org>
Committed: Sat Mar 1 08:58:20 2014 +0100

----------------------------------------------------------------------
 .../karaf/tooling/features/InstallKarsMojo.java | 40 +++++++++++++++-----
 1 file changed, 31 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/eee1df64/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/InstallKarsMojo.java
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/InstallKarsMojo.java
b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/InstallKarsMojo.java
index c3bd30b..bd2b9bb 100644
--- a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/InstallKarsMojo.java
+++ b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/InstallKarsMojo.java
@@ -337,7 +337,7 @@ public class InstallKarsMojo extends MojoSupport {
         target.getParentFile().mkdirs();
         copy(source, target);
     }
-    
+
     private boolean acceptScope(Artifact artifact) {
         return "compile".equals(artifact.getScope()) || "runtime".equals(artifact.getScope());
     }
@@ -391,6 +391,28 @@ public class InstallKarsMojo extends MojoSupport {
                         properties.put(FEATURES_REPOSITORIES, existingFeatureRepos);
                     }
                     Features repo = readFeatures(uri);
+                    for (String innerRepository : repo.getRepository()) {
+                        String innerRepositoryPath = MavenUtil.pathFromMaven(innerRepository);
+                        File innerRepositoryTargetInSystemRepository = new File(system.resolve(innerRepositoryPath));
+                        if (!innerRepositoryTargetInSystemRepository.exists()) {
+                            File innerRepositorySourceFile = resolve(innerRepository);
+                            innerRepositoryTargetInSystemRepository.getParentFile().mkdirs();
+                            copy(innerRepositorySourceFile, innerRepositoryTargetInSystemRepository);
+
+                            // add metadata for snapshot
+                            Artifact innerRepositoryArtifact = MavenUtil.mvnToArtifact(innerRepository);
+                            if (innerRepositoryArtifact.isSnapshot()) {
+                                getLog().debug("Feature repository " + innerRepository +
" is a SNAPSHOT, generate the maven-metadata-local.xml file");
+                                File metadataTarget = new File(innerRepositoryTargetInSystemRepository.getParentFile(),
"maven-metadata-local.xml");
+                                try {
+                                    MavenUtil.generateMavenMetadata(innerRepositoryArtifact,
metadataTarget);
+                                } catch (Exception e) {
+                                    getLog().warn("Could not create maven-metadata-local.xml",
e);
+                                    getLog().warn("It means that this SNAPSHOT could be overwritten
by an older one present on remote repositories");
+                                }
+                            }
+                        }
+                    }
                     for (Feature feature : repo.getFeature()) {
                         featureSet.add(feature);
                         if (startupFeatures != null && startupFeatures.contains(feature.getName()))
{
@@ -453,7 +475,7 @@ public class InstallKarsMojo extends MojoSupport {
         }
 
         private String retrieveProperty(Properties properties, String key) {
-            return properties.containsKey(key) && properties.get(key) != null ? 
properties.get(key) + "," : "";
+            return properties.containsKey(key) && properties.get(key) != null ? properties.get(key)
+ "," : "";
         }
 
         private Features readFeatures(URI uri) throws XMLStreamException, JAXBException,
IOException {
@@ -514,7 +536,7 @@ public class InstallKarsMojo extends MojoSupport {
                 String location = bundle.getLocation();
                 String startLevel = Integer.toString(bundle.getStartLevel() == 0 ? defaultStartLevel
: bundle.getStartLevel());
                 if (startupProperties.containsKey(location)) {
-                    int oldStartLevel = Integer.decode((String)startupProperties.get(location));
+                    int oldStartLevel = Integer.decode((String) startupProperties.get(location));
                     if (oldStartLevel > bundle.getStartLevel()) {
                         startupProperties.put(location, startLevel);
                     }
@@ -547,7 +569,7 @@ public class InstallKarsMojo extends MojoSupport {
 
         @Override
         public void installFeatures(Set<org.apache.karaf.features.Feature> features,
EnumSet<Option> options)
-            throws Exception {
+                throws Exception {
         }
 
         @Override
@@ -589,11 +611,11 @@ public class InstallKarsMojo extends MojoSupport {
             return null;
         }
 
-		@Override
-		public void refreshRepository(URI uri) throws Exception {
-			// TODO Auto-generated method stub
-			
-		}
+        @Override
+        public void refreshRepository(URI uri) throws Exception {
+            // TODO Auto-generated method stub
+
+        }
     }
 
 }


Mime
View raw message