You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2014/03/01 08:57:37 UTC
git commit: [KARAF-2732] Include feature inner repository in assembly
Repository: karaf
Updated Branches:
refs/heads/master 5468c9ebe -> a10c55801
[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/a10c5580
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/a10c5580
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/a10c5580
Branch: refs/heads/master
Commit: a10c558014d05ab17e8f186cd2bad8266dceb45b
Parents: 5468c9e
Author: Jean-Baptiste Onofré <jb...@apache.org>
Authored: Sat Mar 1 08:56:53 2014 +0100
Committer: Jean-Baptiste Onofré <jb...@apache.org>
Committed: Sat Mar 1 08:56:53 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/a10c5580/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 2ba8e11..a2ee978 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 {
@@ -524,7 +546,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);
}
@@ -557,7 +579,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
@@ -599,11 +621,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
+
+ }
}
}