You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2019/12/02 17:43:11 UTC

[camel-quarkus] branch master updated: Fix #494 Group catalog re-generation and formatting mojos under a single profile

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

lburgazzoli 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 e41250f  Fix #494 Group catalog re-generation and formatting mojos under a single profile
e41250f is described below

commit e41250fd2d15cf8d575328a520a25831efec0af8
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Mon Dec 2 11:53:39 2019 +0100

    Fix #494 Group catalog re-generation and formatting mojos under a single profile
---
 .github/workflows/pr-validate.yml              |   2 +-
 docs/modules/ROOT/pages/contributor-guide.adoc |  20 +++-
 extensions/pom.xml                             |  18 +--
 integration-tests/pom.xml                      |   3 +-
 pom.xml                                        | 156 +++++++++++++++++--------
 poms/bom-deployment/pom.xml                    |   3 +-
 poms/bom/pom.xml                               |   3 +-
 tooling/scripts/sort-poms.groovy               |   5 +
 8 files changed, 132 insertions(+), 78 deletions(-)

diff --git a/.github/workflows/pr-validate.yml b/.github/workflows/pr-validate.yml
index 16e5058..7da39c3 100644
--- a/.github/workflows/pr-validate.yml
+++ b/.github/workflows/pr-validate.yml
@@ -31,4 +31,4 @@ jobs:
       with:
         java-version: 1.8
     - name: mvn package
-      run: ./mvnw -fae -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn clean package -Plicense license:check -DskipTests
+      run: ./mvnw -fae -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn clean package -Pcheck-format -DskipTests
diff --git a/docs/modules/ROOT/pages/contributor-guide.adoc b/docs/modules/ROOT/pages/contributor-guide.adoc
index 7575f7b..2d4d8b1 100644
--- a/docs/modules/ROOT/pages/contributor-guide.adoc
+++ b/docs/modules/ROOT/pages/contributor-guide.adoc
@@ -114,11 +114,21 @@ may consider omitting explicit `nameBase` in some cases.
    `docs/modules/ROOT/pages/extensions/foo-abc.adoc`. After completing the page, run `mvn clean install -DskipTests`
    from the root of the source tree to add your extension to the autogenerated list of extensions.
 
-11. Before sending a pull request, please make sure you have done the following:
+11. Before sending a pull request, please make sure you have run the following Maven command:
 +
-* Run `mvn license:format -Plicense` to add license headers to the new files.
-* Run `mvn process-resources` to re-generate the list of extensions and the Camel Quarkus Catalog
-* Run `cd extensions && mvn groovy:execute@sort-poms` to sort elements in various POM files properly
-* Squash your commits
+[code,shell]
+----
+$ mvn process-resources -Pformat
+----
++
+The above command will perform the following tasks:
++
+* Add license headers to the new files
+* Re-generate the list of extensions and the Camel Quarkus Catalog
+* Sort elements in various POM files properly
++
+Review the result visually.
++
+Please squash your commits before sending a pull request.
 
 Good luck!
diff --git a/extensions/pom.xml b/extensions/pom.xml
index f745376..b9f85ee 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -42,7 +42,7 @@
         <module>http-common</module>
         <module>reactive-executor</module>
 
-        <!-- extensions a..z -->
+        <!-- extensions a..z; do not remove this comment, it is important when sorting via  mvn process-resources -Pformat -->
         <module>attachments</module>
         <module>aws-ecs</module>
         <module>aws-eks</module>
@@ -111,22 +111,6 @@
                             <source>file:///${project.basedir}/../tooling/scripts/validate-extension-metadata.groovy</source>
                         </configuration>
                     </execution>
-                    <execution>
-                        <!-- Can be called manually using cd extensions && mvn groovy:execute@sort-poms -->
-                        <id>sort-poms</id>
-                        <inherited>false</inherited>
-                        <goals>
-                            <goal>execute</goal>
-                        </goals>
-                        <phase>none</phase>
-                        <configuration>
-                            <properties>
-                                <sortModulesPaths>pom.xml,../integration-tests/pom.xml</sortModulesPaths>
-                                <sortDependencyManagementPaths>../poms/bom/pom.xml,../poms/bom-deployment/pom.xml</sortDependencyManagementPaths>
-                            </properties>
-                            <source>file:///${project.basedir}/../tooling/scripts/sort-poms.groovy</source>
-                        </configuration>
-                    </execution>
                 </executions>
                 <dependencies>
                     <dependency>
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 3f5a5b2..4db60f9 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -109,8 +109,7 @@
         <module>core-main</module>
         <module>core-impl</module>
 
-        <!-- Sort using cd extensions && mvn groovy:execute@sort-poms -->
-        <!-- extensions a..z -->
+        <!-- extensions a..z; do not remove this comment, it is important when sorting via  mvn process-resources -Pformat -->
         <module>aws</module>
         <module>bean</module>
         <module>bean-validator</module>
diff --git a/pom.xml b/pom.xml
index 51703b9..7be9b45 100644
--- a/pom.xml
+++ b/pom.xml
@@ -259,6 +259,62 @@
                     <artifactId>groovy-maven-plugin</artifactId>
                     <version>${groovy-maven-plugin.version}</version>
                 </plugin>
+
+                <!-- license-maven-plugin is not necessarily relevant for user applications.
+                     It is managed here so that we can have its config defined on a sigle place.
+                     It is executed from profiles only -->
+                <plugin>
+                    <groupId>com.mycila</groupId>
+                    <artifactId>license-maven-plugin</artifactId>
+                    <version>${mycila-license.version}</version>
+                    <configuration>
+                        <failIfUnknown>true</failIfUnknown>
+                        <header>header.txt</header>
+                        <excludes>
+                            <exclude>KEYS</exclude>
+                            <exclude>**/NOTICE</exclude>
+                            <exclude>**/LICENSE</exclude>
+                            <exclude>**/NOTICE.txt</exclude>
+                            <exclude>**/LICENSE.txt</exclude>
+                            <exclude>**/*.lock</exclude>
+                            <exclude>doap.rdf</exclude>
+                            <exclude>**/README</exclude>
+                            <exclude>**/*.adoc</exclude>
+                            <exclude>**/node_modules/**</exclude>
+                            <exclude>node/**</exclude>
+                            <exclude>**/cacerts</exclude>
+                            <exclude>**/*.p12</exclude>
+                            <exclude>**/*.txt</exclude>
+                            <exclude>.mvn/**</exclude>
+                            <exclude>mvnw*</exclude>
+                            <exclude>**/META-INF/persistence*.xsd</exclude>
+                            <exclude>**/pom.xml.versionsBackup</exclude>
+                            <exclude>ide-config/**</exclude>
+                            <exclude>**/*.mvel</exclude>
+                            <exclude>**/*.pem</exclude>
+                            <exclude>**/camel-quarkus-test-list.xml</exclude>
+                        </excludes>
+                        <mapping>
+                            <groovy>SLASHSTAR_STYLE</groovy>
+                            <java>SLASHSTAR_STYLE</java>
+                            <Jenkinsfile>SLASHSTAR_STYLE</Jenkinsfile>
+                            <Jenkinsfile.quarkus>SLASHSTAR_STYLE</Jenkinsfile.quarkus>
+                            <properties>CAMEL_PROPERTIES_STYLE</properties>
+                            <spring.factories>CAMEL_PROPERTIES_STYLE</spring.factories>
+                            <spring.provides>CAMEL_PROPERTIES_STYLE</spring.provides>
+                        </mapping>
+                        <headerDefinitions>
+                            <headerDefinition>license-properties-headerdefinition.xml</headerDefinition>
+                        </headerDefinitions>
+                    </configuration>
+                    <dependencies>
+                        <dependency>
+                            <groupId>org.apache.camel</groupId>
+                            <artifactId>camel-buildtools</artifactId>
+                            <version>${camel.version}</version>
+                        </dependency>
+                    </dependencies>
+                </plugin>
             </plugins>
         </pluginManagement>
     </build>
@@ -303,60 +359,62 @@
             </build>
         </profile>
         <profile>
-            <id>license</id>
+            <id>format</id>
             <build>
                 <plugins>
                     <plugin>
                         <groupId>com.mycila</groupId>
                         <artifactId>license-maven-plugin</artifactId>
-                        <version>${mycila-license.version}</version>
-                        <configuration>
-                            <failIfUnknown>true</failIfUnknown>
-                            <header>header.txt</header>
-                            <excludes>
-                                <exclude>KEYS</exclude>
-                                <exclude>**/NOTICE</exclude>
-                                <exclude>**/LICENSE</exclude>
-                                <exclude>**/NOTICE.txt</exclude>
-                                <exclude>**/LICENSE.txt</exclude>
-                                <exclude>**/*.lock</exclude>
-                                <exclude>doap.rdf</exclude>
-                                <exclude>**/README</exclude>
-                                <exclude>**/*.adoc</exclude>
-                                <exclude>**/node_modules/**</exclude>
-                                <exclude>node/**</exclude>
-                                <exclude>**/cacerts</exclude>
-                                <exclude>**/*.p12</exclude>
-                                <exclude>**/*.txt</exclude>
-                                <exclude>.mvn/**</exclude>
-                                <exclude>mvnw*</exclude>
-                                <exclude>**/META-INF/persistence*.xsd</exclude>
-                                <exclude>**/pom.xml.versionsBackup</exclude>
-                                <exclude>ide-config/**</exclude>
-                                <exclude>**/*.mvel</exclude>
-                                <exclude>**/*.pem</exclude>
-                                <exclude>**/camel-quarkus-test-list.xml</exclude>
-                            </excludes>
-                            <mapping>
-                                <groovy>SLASHSTAR_STYLE</groovy>
-                                <java>SLASHSTAR_STYLE</java>
-                                <Jenkinsfile>SLASHSTAR_STYLE</Jenkinsfile>
-                                <Jenkinsfile.quarkus>SLASHSTAR_STYLE</Jenkinsfile.quarkus>
-                                <properties>CAMEL_PROPERTIES_STYLE</properties>
-                                <spring.factories>CAMEL_PROPERTIES_STYLE</spring.factories>
-                                <spring.provides>CAMEL_PROPERTIES_STYLE</spring.provides>
-                            </mapping>
-                            <headerDefinitions>
-                                <headerDefinition>license-properties-headerdefinition.xml</headerDefinition>
-                            </headerDefinitions>
-                        </configuration>
-                        <dependencies>
-                            <dependency>
-                                <groupId>org.apache.camel</groupId>
-                                <artifactId>camel-buildtools</artifactId>
-                                <version>${camel.version}</version>
-                            </dependency>
-                        </dependencies>
+                        <executions>
+                            <execution>
+                                <id>license-format</id>
+                                <goals>
+                                    <goal>format</goal>
+                                </goals>
+                                <phase>validate</phase>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    <plugin>
+                        <groupId>org.codehaus.gmaven</groupId>
+                        <artifactId>groovy-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>sort-poms</id>
+                                <inherited>false</inherited>
+                                <goals>
+                                    <goal>execute</goal>
+                                </goals>
+                                <phase>none</phase>
+                                <configuration>
+                                    <properties>
+                                        <sortModulesPaths>extensions/pom.xml,integration-tests/pom.xml</sortModulesPaths>
+                                        <sortDependencyManagementPaths>poms/bom/pom.xml,poms/bom-deployment/pom.xml</sortDependencyManagementPaths>
+                                    </properties>
+                                    <source>file:///${project.basedir}/tooling/scripts/sort-poms.groovy</source>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
+            <id>check-format</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>com.mycila</groupId>
+                        <artifactId>license-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>license-format</id>
+                                <goals>
+                                    <goal>check</goal>
+                                </goals>
+                                <phase>validate</phase>
+                            </execution>
+                        </executions>
                     </plugin>
                 </plugins>
             </build>
diff --git a/poms/bom-deployment/pom.xml b/poms/bom-deployment/pom.xml
index b2a7aa0..5bde4ca 100644
--- a/poms/bom-deployment/pom.xml
+++ b/poms/bom-deployment/pom.xml
@@ -60,8 +60,7 @@
                 <scope>import</scope>
             </dependency>
 
-            <!-- Sort using cd extensions && mvn groovy:execute@sort-poms -->
-            <!-- Dependencies a..z -->
+            <!-- Dependencies a..z; do not remove this comment, it is important when sorting via  mvn process-resources -Pformat -->
 
             <!--$ org.apache.camel.quarkus $-->
             <dependency>
diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml
index be3b06e..da6b3c6 100644
--- a/poms/bom/pom.xml
+++ b/poms/bom/pom.xml
@@ -48,8 +48,7 @@
                 <scope>import</scope>
             </dependency>
 
-            <!-- Sort using cd extensions && mvn groovy:execute@sort-poms -->
-            <!-- Dependencies a..z -->
+            <!-- Dependencies a..z; do not remove this comment, it is important when sorting via  mvn process-resources -Pformat -->
 
             <!--$ org.apache.camel $-->
             <dependency>
diff --git a/tooling/scripts/sort-poms.groovy b/tooling/scripts/sort-poms.groovy
index bb35016..0b63cd1 100644
--- a/tooling/scripts/sort-poms.groovy
+++ b/tooling/scripts/sort-poms.groovy
@@ -15,6 +15,11 @@
  * limitations under the License.
  */
 
+/**
+ * A script for sorting child modules and dependencyManagement dependencies in pom.xml files.
+ * Only elements will be sorted that occur after a comment containing the {@code a..z} marker string.
+ */
+
 import java.nio.file.Path
 import java.nio.file.Paths
 import java.nio.file.Files