You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2019/09/30 17:59:32 UTC

[camel-quarkus] branch master updated: chore(build): move depdendencies enforcer script to build/scripts

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


The following commit(s) were added to refs/heads/master by this push:
     new 7669973  chore(build): move depdendencies enforcer script to build/scripts
     new 2d6c3f2  Merge pull request #215 from lburgazzoli/dependencies-validation
7669973 is described below

commit 7669973d3cf0d2a541917ef822d96036619378e5
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Mon Sep 30 17:45:06 2019 +0200

    chore(build): move depdendencies enforcer script to build/scripts
---
 build/scripts/validate-dependencies.groovy | 34 +++++++++++++++++++++++++++
 poms/build-parent/pom.xml                  | 37 +++++++++++++++---------------
 2 files changed, 53 insertions(+), 18 deletions(-)

diff --git a/build/scripts/validate-dependencies.groovy b/build/scripts/validate-dependencies.groovy
new file mode 100644
index 0000000..360a806
--- /dev/null
+++ b/build/scripts/validate-dependencies.groovy
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+final List<String> badDeps = []
+final File pomXml = new File(project.basedir, "pom.xml")
+
+if (pomXml.exists()) {
+    def pomXmlProject = new XmlParser().parseText(pomXml.getText('UTF-8'))
+    pomXmlProject.dependencies.dependency
+        .findAll {
+            !it.version.text().isEmpty()
+        }
+        .each {
+            badDeps << "in ${project.basedir}/pom.xml : ${it.groupId.text()}:${it.artifactId.text()}"
+        }
+}
+
+if (!badDeps.isEmpty()) {
+    throw new RuntimeException("\nRemove explicit version from the following dependencies and rather manage them in one of the BOMs:\n\n    "
+            + badDeps.join("\n    "))
+}
\ No newline at end of file
diff --git a/poms/build-parent/pom.xml b/poms/build-parent/pom.xml
index c01094c..1ffca0d 100644
--- a/poms/build-parent/pom.xml
+++ b/poms/build-parent/pom.xml
@@ -44,6 +44,7 @@
         <jandex-maven-plugin.version>1.0.6</jandex-maven-plugin.version>
         <maven-resources-plugin.version>3.1.0</maven-resources-plugin.version>
         <docker-maven-plugin.version>0.3.0</docker-maven-plugin.version>
+        <directory-maven-plugin.version>0.3.1</directory-maven-plugin.version>
     </properties>
 
     <dependencyManagement>
@@ -109,6 +110,23 @@
 
         <plugins>
             <plugin>
+                <groupId>org.commonjava.maven.plugins</groupId>
+                <artifactId>directory-maven-plugin</artifactId>
+                <version>${directory-maven-plugin.version}</version>
+                <executions>
+                    <execution>
+                        <id>directories</id>
+                        <goals>
+                            <goal>highest-basedir</goal>
+                        </goals>
+                        <phase>validate</phase>
+                        <configuration>
+                            <property>camel.quarkus.project.root</property>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
                 <groupId>org.codehaus.gmaven</groupId>
                 <artifactId>groovy-maven-plugin</artifactId>
                 <executions>
@@ -119,24 +137,7 @@
                         </goals>
                         <phase>validate</phase>
                         <configuration>
-                            <useSharedClassLoader>false</useSharedClassLoader>
-                            <source><![CDATA[
-                                final List<String> badDeps = []
-                                final File pomXml = new File(project.basedir, "pom.xml")
-                                if (pomXml.exists()) {
-                                    def pomXmlProject = new XmlParser().parseText(pomXml.getText('UTF-8'))
-                                    pomXmlProject.dependencies.dependency
-                                        .findAll { dep ->
-                                            !dep.version.text().isEmpty()
-                                        }.stream()
-                                        .map { dep -> "in "+ project.basedir +"/pom.xml : "+ dep.groupId.text() +":"+ dep.artifactId.text() }
-                                        .each { key -> badDeps.add(key) }
-                                }
-                                if (!badDeps.isEmpty()) {
-                                    throw new RuntimeException("\nRemove explicit version from the following dependencies and rather manage them in one of the BOMs:\n\n    "
-                                        + badDeps.join("\n    "))
-                                }
-                            ]]></source>
+                            <source>file://${camel.quarkus.project.root}/build/scripts/validate-dependencies.groovy</source>
                         </configuration>
                     </execution>
                 </executions>