Added custom repositories to the starters

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

Branch: refs/heads/master
Commit: 33f5772170a1cbbd55e5bd739812a99fcec1ecbb
Parents: 8ab9206
Author: Nicola Ferraro <ni.ferr...@gmail.com>
Authored: Thu Sep 22 12:35:12 2016 +0200
Committer: Nicola Ferraro <ni.ferr...@gmail.com>
Committed: Thu Sep 22 12:36:09 2016 +0200

----------------------------------------------------------------------
 components-starter/camel-jira-starter/pom.xml   |  6 ++++
 components-starter/camel-nagios-starter/pom.xml | 13 +++++++++
 components-starter/camel-paho-starter/pom.xml   |  9 ++++++
 .../camel-restlet-starter/pom.xml               |  7 +++++
 components-starter/camel-script-starter/pom.xml |  7 +++++
 .../maven/packaging/SpringBootStarterMojo.java  | 30 ++++++++++++++++++++
 6 files changed, 72 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/33f57721/components-starter/camel-jira-starter/pom.xml
----------------------------------------------------------------------
diff --git a/components-starter/camel-jira-starter/pom.xml 
b/components-starter/camel-jira-starter/pom.xml
index 9c4d84b..a30050e 100644
--- a/components-starter/camel-jira-starter/pom.xml
+++ b/components-starter/camel-jira-starter/pom.xml
@@ -50,4 +50,10 @@
       <artifactId>camel-spring-boot-starter</artifactId>
     </dependency>
   </dependencies>
+  <repositories>
+    <repository>
+      <id>atlassian-public</id>
+      <url>https://maven.atlassian.com/repository/public</url>
+    </repository>
+  </repositories>
 </project>

http://git-wip-us.apache.org/repos/asf/camel/blob/33f57721/components-starter/camel-nagios-starter/pom.xml
----------------------------------------------------------------------
diff --git a/components-starter/camel-nagios-starter/pom.xml 
b/components-starter/camel-nagios-starter/pom.xml
index 326ee0c..3ba507a 100644
--- a/components-starter/camel-nagios-starter/pom.xml
+++ b/components-starter/camel-nagios-starter/pom.xml
@@ -46,4 +46,17 @@
       <artifactId>camel-spring-boot-starter</artifactId>
     </dependency>
   </dependencies>
+  <repositories>
+    <repository>
+      <id>jboss.fs</id>
+      <name>JBoss FuseSource Public Release Repository</name>
+      <url>https://repository.jboss.org/nexus/content/groups/fs-public</url>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+      <releases>
+        <enabled>true</enabled>
+      </releases>
+    </repository>
+  </repositories>
 </project>

http://git-wip-us.apache.org/repos/asf/camel/blob/33f57721/components-starter/camel-paho-starter/pom.xml
----------------------------------------------------------------------
diff --git a/components-starter/camel-paho-starter/pom.xml 
b/components-starter/camel-paho-starter/pom.xml
index 0f6b4de..37552d9 100644
--- a/components-starter/camel-paho-starter/pom.xml
+++ b/components-starter/camel-paho-starter/pom.xml
@@ -46,4 +46,13 @@
       <artifactId>camel-spring-boot-starter</artifactId>
     </dependency>
   </dependencies>
+  <repositories>
+    <repository>
+      <id>eclipse-paho</id>
+      <url>https://repo.eclipse.org/content/repositories/paho-releases</url>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+    </repository>
+  </repositories>
 </project>

http://git-wip-us.apache.org/repos/asf/camel/blob/33f57721/components-starter/camel-restlet-starter/pom.xml
----------------------------------------------------------------------
diff --git a/components-starter/camel-restlet-starter/pom.xml 
b/components-starter/camel-restlet-starter/pom.xml
index ad6998f..f297903 100644
--- a/components-starter/camel-restlet-starter/pom.xml
+++ b/components-starter/camel-restlet-starter/pom.xml
@@ -56,4 +56,11 @@
       <artifactId>hibernate-validator</artifactId>
     </dependency>
   </dependencies>
+  <repositories>
+    <repository>
+      <id>maven-restlet</id>
+      <name>Public online Restlet repository</name>
+      <url>http://maven.restlet.org</url>
+    </repository>
+  </repositories>
 </project>

http://git-wip-us.apache.org/repos/asf/camel/blob/33f57721/components-starter/camel-script-starter/pom.xml
----------------------------------------------------------------------
diff --git a/components-starter/camel-script-starter/pom.xml 
b/components-starter/camel-script-starter/pom.xml
index 1f500c8..1230582 100644
--- a/components-starter/camel-script-starter/pom.xml
+++ b/components-starter/camel-script-starter/pom.xml
@@ -46,4 +46,11 @@
       <artifactId>camel-spring-boot-starter</artifactId>
     </dependency>
   </dependencies>
+  <repositories>
+    <repository>
+      <id>servicemix</id>
+      <name>ServiceMix Repository</name>
+      <url>http://svn.apache.org/repos/asf/servicemix/m2-repo</url>
+    </repository>
+  </repositories>
 </project>

http://git-wip-us.apache.org/repos/asf/camel/blob/33f57721/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java
----------------------------------------------------------------------
diff --git 
a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java
 
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java
index ddea47f..2446b04 100644
--- 
a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java
+++ 
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java
@@ -63,6 +63,7 @@ import 
org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.resolver.ArtifactCollector;
 import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
 import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
+import org.apache.maven.model.Repository;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
@@ -72,6 +73,7 @@ import 
org.apache.maven.shared.dependency.tree.DependencyTreeBuilder;
 import org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException;
 import 
org.apache.maven.shared.dependency.tree.traversal.CollectingDependencyNodeVisitor;
 
+
 /**
  * Generate Spring Boot starter for the component
  *
@@ -164,6 +166,7 @@ public class SpringBootStarterMojo extends AbstractMojo {
             // Apply changes to the starter pom
             fixExcludedDependencies(pom);
             fixAdditionalDependencies(pom);
+            fixAdditionalRepositories(pom);
 
             // Write the starter pom
             File pomFile = new File(starterDir, "pom.xml");
@@ -250,6 +253,33 @@ public class SpringBootStarterMojo extends AbstractMojo {
 
     }
 
+    @SuppressWarnings("unchecked")
+    private void fixAdditionalRepositories(Document pom) throws Exception {
+
+        if (project.getFile() != null) {
+            DocumentBuilder builder = 
DocumentBuilderFactory.newInstance().newDocumentBuilder();
+            Document originalPom = builder.parse(project.getFile());
+
+            XPath xpath = XPathFactory.newInstance().newXPath();
+            Node repositories = (Node) 
xpath.compile("/project/repositories").evaluate(originalPom, 
XPathConstants.NODE);
+            if (repositories != null) {
+                
pom.getDocumentElement().appendChild(pom.importNode(repositories, true));
+            }
+        } else {
+            getLog().warn("Cannot access the project pom file to retrieve 
repositories");
+        }
+    }
+
+    private void appendTextElementIfPresent(Document pom, Element parent, 
String name, String value) {
+        if (value == null || value.length() == 0) {
+            return;
+        }
+        Element element = pom.createElement(name);
+        element.setTextContent(value);
+
+        parent.appendChild(element);
+    }
+
     private Set<String> csvToSet(String csv) {
         if (csv == null || csv.trim().length() == 0) {
             return new TreeSet<>();

Reply via email to