http://git-wip-us.apache.org/repos/asf/camel/blob/8601be89/bom/pom.xml
----------------------------------------------------------------------
diff --git a/bom/pom.xml b/bom/pom.xml
new file mode 100644
index 0000000..e8946bc
--- /dev/null
+++ b/bom/pom.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>camel-parent</artifactId>
+    <version>2.20.0-SNAPSHOT</version>
+    <relativePath>../parent</relativePath>
+  </parent>
+
+  <artifactId>bom-generator</artifactId>
+  <name>Camel :: BOM :: Generator</name>
+  <description>Camel Tooling</description>
+  <packaging>pom</packaging>
+
+  <properties>
+    <camel.osgi.export.pkg />
+  </properties>
+
+  <modules>
+    <module>camel-bom</module>
+  </modules>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>bom-generator-maven-plugin</artifactId>
+        <version>${project.version}</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>generate</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <dependencies>
+            <includes>
+              <include>org.apache.camel:*</include>
+            </includes>
+          </dependencies>
+
+          <sourcePom>${basedir}/target-template-pom.xml</sourcePom>
+          <targetPom>${basedir}/camel-bom/pom.xml</targetPom>
+        </configuration>
+
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/8601be89/bom/target-template-pom.xml
----------------------------------------------------------------------
diff --git a/bom/target-template-pom.xml b/bom/target-template-pom.xml
new file mode 100644
index 0000000..6247c47
--- /dev/null
+++ b/bom/target-template-pom.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.camel</groupId>
+  <artifactId>camel-bom</artifactId>
+  <version>${project.version}</version>
+  <packaging>pom</packaging>
+
+  <name>Camel :: BOM</name>
+  <description>Camel BOM</description>
+
+  <dependencyManagement>
+    <dependencies>
+      <!-- To be filled in -->
+    </dependencies>
+  </dependencyManagement>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>bom-generator-maven-plugin</artifactId>
+        <version>${project.version}</version>
+        <dependencies>
+          <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>bom-generator</artifactId>
+            <version>${project.version}</version>
+          </dependency>
+        </dependencies>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/8601be89/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 567f16d..748a28b 100755
--- a/pom.xml
+++ b/pom.xml
@@ -140,6 +140,7 @@
   <modules>
     <module>parent</module>
     <module>etc</module>
+    <module>bom</module>
     <module>buildingtools</module>
     <module>camel-core</module>
     <module>components</module>

http://git-wip-us.apache.org/repos/asf/camel/blob/8601be89/tooling/maven/bom-generator-maven-plugin/src/main/java/org/apache/camel/maven/bom/generator/BomGeneratorMojo.java
----------------------------------------------------------------------
diff --git 
a/tooling/maven/bom-generator-maven-plugin/src/main/java/org/apache/camel/maven/bom/generator/BomGeneratorMojo.java
 
b/tooling/maven/bom-generator-maven-plugin/src/main/java/org/apache/camel/maven/bom/generator/BomGeneratorMojo.java
index 3f47f15..56950b8 100644
--- 
a/tooling/maven/bom-generator-maven-plugin/src/main/java/org/apache/camel/maven/bom/generator/BomGeneratorMojo.java
+++ 
b/tooling/maven/bom-generator-maven-plugin/src/main/java/org/apache/camel/maven/bom/generator/BomGeneratorMojo.java
@@ -35,10 +35,7 @@ import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpression;
-import javax.xml.xpath.XPathFactory;
+import javax.xml.xpath.*;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -206,14 +203,21 @@ public class BomGeneratorMojo extends AbstractMojo {
         Document pom = builder.parse(sourcePom);
 
         XPath xpath = XPathFactory.newInstance().newXPath();
-        XPathExpression expr = xpath.compile("/project/parent/version");
 
-        Node node = (Node) expr.evaluate(pom, XPathConstants.NODE);
+        XPathExpression parentVersion = 
xpath.compile("/project/parent/version");
+        setActualVersion(pom, parentVersion);
+
+        XPathExpression projectVersion = xpath.compile("/project/version");
+        setActualVersion(pom, projectVersion);
+
+        return pom;
+    }
+
+    private void setActualVersion(Document pom, XPathExpression path) throws 
XPathExpressionException {
+        Node node = (Node) path.evaluate(pom, XPathConstants.NODE);
         if (node != null && node.getTextContent() != null && 
node.getTextContent().trim().equals("${project.version}")) {
             node.setTextContent(project.getVersion());
         }
-
-        return pom;
     }
 
     private void writePom(Document pom) throws Exception {

Reply via email to