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

ppalaga pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 651957d7083 Ban com.sun.xml.bind:jaxb-impl, replace it with 
jaxb-runtime where needed
651957d7083 is described below

commit 651957d7083e8915a14120539d393681d97717ba
Author: Peter Palaga <ppal...@redhat.com>
AuthorDate: Tue Aug 27 16:21:21 2024 +0200

    Ban com.sun.xml.bind:jaxb-impl, replace it with jaxb-runtime where needed
---
 apache-camel/pom.xml                               |  1 +
 catalog/camel-allcomponents/pom.xml                |  4 +++
 components/camel-jaxb/pom.xml                      | 12 -------
 components/camel-jmx/pom.xml                       |  5 ++-
 components/camel-parquet-avro/pom.xml              |  4 +++
 .../camel-salesforce-component/pom.xml             |  5 ++-
 components/camel-soap/pom.xml                      | 14 --------
 components/camel-swift/pom.xml                     | 10 ++++++
 core/camel-xml-jaxb/pom.xml                        | 10 ++----
 docs/pom.xml                                       |  2 ++
 .../ROOT/pages/camel-4x-upgrade-guide-4_8.adoc     |  8 +++++
 dsl/camel-componentdsl/pom.xml                     |  1 +
 dsl/camel-endpointdsl/pom.xml                      |  3 +-
 pom.xml                                            | 40 +++++++++-------------
 tests/camel-itest/pom.xml                          | 11 +-----
 tooling/{ => enforcer-rules}/pom.xml               | 24 +++----------
 .../main/resources/camel-banned-dependencies.xml   | 29 ++++++++++++++++
 tooling/pom.xml                                    |  1 +
 18 files changed, 90 insertions(+), 94 deletions(-)

diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml
index b2ae6d9cae3..7b97c774362 100644
--- a/apache-camel/pom.xml
+++ b/apache-camel/pom.xml
@@ -39,6 +39,7 @@
         <!-- we do not need remote resources in assembly -->
         <remoteresources.skip>true</remoteresources.skip>
         <tarLongFileMode>gnu</tarLongFileMode>
+        <enforcer.phase>none</enforcer.phase><!-- Save some time -->
     </properties>
 
     <repositories>
diff --git a/catalog/camel-allcomponents/pom.xml 
b/catalog/camel-allcomponents/pom.xml
index 63baf6c9a69..b86ebc70de2 100644
--- a/catalog/camel-allcomponents/pom.xml
+++ b/catalog/camel-allcomponents/pom.xml
@@ -32,6 +32,10 @@
     <name>Camel :: All Components Sync point</name>
     <description>Depends on all components to ensure correct build 
ordering</description>
 
+    <properties>
+        <enforcer.phase>none</enforcer.phase><!-- We enforce all dependencies 
individuall, so there is no point enforcing here again -->
+    </properties>
+
     <repositories>
         <repository>
             <id>atlassian</id>
diff --git a/components/camel-jaxb/pom.xml b/components/camel-jaxb/pom.xml
index af10c0f633b..5faf0d507a9 100644
--- a/components/camel-jaxb/pom.xml
+++ b/components/camel-jaxb/pom.xml
@@ -47,18 +47,6 @@
             <artifactId>camel-xml-jaxp</artifactId>
         </dependency>
 
-        <dependency>
-            <groupId>com.sun.xml.bind</groupId>
-            <artifactId>jaxb-core</artifactId>
-            <version>${jaxb-core-version}</version>
-        </dependency>
-        <dependency>
-            <groupId>com.sun.xml.bind</groupId>
-            <artifactId>jaxb-impl</artifactId>
-            <version>${jaxb-impl-version}</version>
-            <optional>true</optional>
-        </dependency>
-
         <!-- for testing -->
         <dependency>
             <groupId>org.junit.jupiter</groupId>
diff --git a/components/camel-jmx/pom.xml b/components/camel-jmx/pom.xml
index 92bf4d160fd..167e934247b 100644
--- a/components/camel-jmx/pom.xml
+++ b/components/camel-jmx/pom.xml
@@ -51,9 +51,8 @@
         </dependency>
 
         <dependency>
-            <groupId>com.sun.xml.bind</groupId>
-            <artifactId>jaxb-impl</artifactId>
-            <version>${jaxb-impl-version}</version>
+            <groupId>org.glassfish.jaxb</groupId>
+            <artifactId>jaxb-runtime</artifactId>
         </dependency>
 
         <!-- test dependencies -->
diff --git a/components/camel-parquet-avro/pom.xml 
b/components/camel-parquet-avro/pom.xml
index d75eb7ed1c2..a177efd25b6 100644
--- a/components/camel-parquet-avro/pom.xml
+++ b/components/camel-parquet-avro/pom.xml
@@ -31,6 +31,10 @@
     <name>Camel :: Parquet Avro</name>
     <description>Camel ParquetAvro DataFormat</description>
 
+    <properties>
+        <enforcer.phase>none</enforcer.phase><!-- hadoop-common seems to 
require com.sun.xml.bind:jaxb-impl via com.github.pjfanning:jersey-json -->
+    </properties>
+
     <dependencies>
 
         <dependency>
diff --git a/components/camel-salesforce/camel-salesforce-component/pom.xml 
b/components/camel-salesforce/camel-salesforce-component/pom.xml
index 8e4036e0543..b8ba829c277 100644
--- a/components/camel-salesforce/camel-salesforce-component/pom.xml
+++ b/components/camel-salesforce/camel-salesforce-component/pom.xml
@@ -116,9 +116,8 @@
         </dependency>
 
         <dependency>
-            <groupId>com.sun.xml.bind</groupId>
-            <artifactId>jaxb-impl</artifactId>
-            <version>${jaxb-impl-version}</version>
+            <groupId>org.glassfish.jaxb</groupId>
+            <artifactId>jaxb-runtime</artifactId>
         </dependency>
         <!-- Pub/Sub API dependencies -->
         <dependency>
diff --git a/components/camel-soap/pom.xml b/components/camel-soap/pom.xml
index cbe9e4a301d..a643bb5cceb 100644
--- a/components/camel-soap/pom.xml
+++ b/components/camel-soap/pom.xml
@@ -46,11 +46,6 @@
             <artifactId>camel-jaxb</artifactId>
         </dependency>
 
-        <dependency>
-            <groupId>com.sun.xml.bind</groupId>
-            <artifactId>jaxb-impl</artifactId>
-            <version>${jaxb-impl-version}</version>
-        </dependency>
         <dependency>
             <groupId>jakarta.xml.ws</groupId>
             <artifactId>jakarta.xml.ws-api</artifactId>
@@ -112,15 +107,6 @@
             <version>${spring-version}</version>
             <scope>test</scope>
         </dependency>
-
-        <!-- needed by jetty http server to load class: 
org.jvnet.staxex.util.XMLStreamReaderToXMLStreamWriter -->
-        <dependency>
-            <groupId>com.sun.xml.bind</groupId>
-            <artifactId>jaxb-osgi</artifactId>
-            <version>${jaxb-osgi-version}</version>
-            <scope>test</scope>
-        </dependency>
-
     </dependencies>
 
     <build>
diff --git a/components/camel-swift/pom.xml b/components/camel-swift/pom.xml
index 340df8536e0..3651676c360 100644
--- a/components/camel-swift/pom.xml
+++ b/components/camel-swift/pom.xml
@@ -45,6 +45,16 @@
             <groupId>com.prowidesoftware</groupId>
             <artifactId>pw-iso20022</artifactId>
             <version>${prowide-version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.sun.xml.bind</groupId>
+                    <artifactId>jaxb-impl</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.glassfish.jaxb</groupId>
+            <artifactId>jaxb-runtime</artifactId>
         </dependency>
 
         <!-- testing -->
diff --git a/core/camel-xml-jaxb/pom.xml b/core/camel-xml-jaxb/pom.xml
index 50911d344a9..8718a65de7a 100644
--- a/core/camel-xml-jaxb/pom.xml
+++ b/core/camel-xml-jaxb/pom.xml
@@ -47,14 +47,8 @@
 
         <!-- need JAXB implementation -->
         <dependency>
-            <groupId>com.sun.xml.bind</groupId>
-            <artifactId>jaxb-core</artifactId>
-            <version>${jaxb-core-version}</version>            
-        </dependency>
-        <dependency>
-            <groupId>com.sun.xml.bind</groupId>
-            <artifactId>jaxb-impl</artifactId>
-            <version>${jaxb-impl-version}</version>
+            <groupId>org.glassfish.jaxb</groupId>
+            <artifactId>jaxb-runtime</artifactId>
         </dependency>
 
         <dependency>
diff --git a/docs/pom.xml b/docs/pom.xml
index 7a5ef8e3e04..8025a872b12 100644
--- a/docs/pom.xml
+++ b/docs/pom.xml
@@ -33,8 +33,10 @@
 
     <properties>
         <skipOnUnsupported>true</skipOnUnsupported>
+        <enforcer.phase>none</enforcer.phase><!-- Save some time -->
     </properties>
 
+
     <repositories>
         <repository>
             <id>atlassian</id>
diff --git 
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_8.adoc 
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_8.adoc
index 997e4cb1b2c..96f47f9227a 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_8.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_8.adoc
@@ -38,3 +38,11 @@ You can configure `startupOnly=true` to only sync the cache 
once on startup
 
 Continuing the multi-release tests cleanups, on this one, restricted methods 
from the `CamelTestSupport` class
 have been marked as final and cannot be extended.
+
+=== Preferred JAX-B implementation: `org.glassfish.jaxb:jaxb-runtime`
+
+We stopped relying on `com.sun.xml.bind:jaxb-impl` in favor of 
`org.glassfish.jaxb:jaxb-runtime`.
+This change should have no impact on existing code, because recent versions of 
the two artifacts bring the same classes.
+The main motivation for this change is to allow projects that still require 
classes from `javax.xml.bind` package
+to be able to depend on pre-3.x versions of `com.sun.xml.bind:jaxb-impl` 
together with the recent version of
+`org.glassfish.jaxb:jaxb-runtime` brought by Camel.
diff --git a/dsl/camel-componentdsl/pom.xml b/dsl/camel-componentdsl/pom.xml
index 40041126ecc..5582e149417 100644
--- a/dsl/camel-componentdsl/pom.xml
+++ b/dsl/camel-componentdsl/pom.xml
@@ -36,6 +36,7 @@
         <firstVersion>3.1.0</firstVersion>
         <title>Java Component DSL</title>
         <label>dsl</label>
+        <enforcer.phase>none</enforcer.phase><!-- Save some time -->
     </properties>
 
     <repositories>
diff --git a/dsl/camel-endpointdsl/pom.xml b/dsl/camel-endpointdsl/pom.xml
index daba28afcf8..28e002e5e56 100644
--- a/dsl/camel-endpointdsl/pom.xml
+++ b/dsl/camel-endpointdsl/pom.xml
@@ -36,6 +36,7 @@
         <firstVersion>3.0.0</firstVersion>
         <title>Java Endpoint DSL</title>
         <label>dsl</label>
+        <enforcer.phase>none</enforcer.phase><!-- Save some time -->
     </properties>
 
     <repositories>
@@ -50,7 +51,7 @@
                 <enabled>true</enabled>
             </releases>
         </repository>
-    </repositories>  
+    </repositories>
 
     <dependencies>
 
diff --git a/pom.xml b/pom.xml
index ca238d8878d..c84c1e56e87 100644
--- a/pom.xml
+++ b/pom.xml
@@ -137,6 +137,8 @@
 
         <camel.javadoc.offline>false</camel.javadoc.offline>
         <invoker.skip>${skipTests}</invoker.skip>
+
+        <enforcer.phase>none</enforcer.phase><!-- We do not enforce with 
-Dquickly, the property is overridden in the full profile -->
     </properties>
 
     <!-- Comment out the snapshot repositories as we don't need them now -->
@@ -164,13 +166,21 @@
                 <executions>
                     <execution>
                         <id>enforce-maven-version</id>
-                        <phase>none
-                        </phase><!-- unbound here to speedup -Dquickly build; 
bound to a phase in the full profile -->
+                        <phase>${enforcer.phase}</phase>
+                        <configuration>
+                            <rules>
+                                <requireMavenVersion>
+                                    <version>3.5.0</version>
+                                </requireMavenVersion>
+                                <externalRules>
+                                    
<location>${maven.multiModuleProjectDirectory}/tooling/enforcer-rules/src/main/resources/camel-banned-dependencies.xml</location>
+                                </externalRules>
+                            </rules>
+                        </configuration>
                     </execution>
                     <execution>
                         <id>enforce-java-version</id>
-                        <phase>none
-                        </phase><!-- unbound here to speedup -Dquickly build; 
bound to a phase in the full profile -->
+                        <phase>${enforcer.phase}</phase>
                     </execution>
                 </executions>
             </plugin>
@@ -860,6 +870,9 @@
                     <name>!quickly</name>
                 </property>
             </activation>
+            <properties>
+                <enforcer.phase>validate</enforcer.phase><!-- We do not 
enforce with -Dquickly, but we enforce otherwise -->
+            </properties>
             <build>
                 <plugins>
                     <plugin>
@@ -875,25 +888,6 @@
                             </execution>
                         </executions>
                     </plugin>
-                    <plugin>
-                        <groupId>org.apache.maven.plugins</groupId>
-                        <artifactId>maven-enforcer-plugin</artifactId>
-                        <executions>
-                            <execution>
-                                <id>enforce-maven-version</id>
-                                <goals>
-                                    <goal>enforce</goal>
-                                </goals>
-                                <configuration>
-                                    <rules>
-                                        <requireMavenVersion>
-                                            <version>3.5.0</version>
-                                        </requireMavenVersion>
-                                    </rules>
-                                </configuration>
-                            </execution>
-                        </executions>
-                    </plugin>
                     <plugin>
                         <groupId>org.apache.maven.plugins</groupId>
                         <artifactId>maven-surefire-plugin</artifactId>
diff --git a/tests/camel-itest/pom.xml b/tests/camel-itest/pom.xml
index f052ef22e4a..ce72a3ab2c7 100644
--- a/tests/camel-itest/pom.xml
+++ b/tests/camel-itest/pom.xml
@@ -218,7 +218,7 @@
             <artifactId>derbytools</artifactId>
             <version>${derby-version}</version>
             <scope>test</scope>
-        </dependency>        
+        </dependency>
         <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-orm</artifactId>
@@ -363,15 +363,6 @@
             <artifactId>jboss-logging</artifactId>
             <version>${jboss-logging-version}</version>
         </dependency>
-
-        <!-- needed by jetty http server to load class: 
org.jvnet.staxex.util.XMLStreamReaderToXMLStreamWriter -->
-        <dependency>
-            <groupId>com.sun.xml.bind</groupId>
-            <artifactId>jaxb-osgi</artifactId>
-            <version>${jaxb-osgi-version}</version>
-            <scope>test</scope>
-        </dependency>
-
     </dependencies>
 
     <build>
diff --git a/tooling/pom.xml b/tooling/enforcer-rules/pom.xml
similarity index 65%
copy from tooling/pom.xml
copy to tooling/enforcer-rules/pom.xml
index 64d71ff6d96..d3d8f093301 100644
--- a/tooling/pom.xml
+++ b/tooling/enforcer-rules/pom.xml
@@ -22,28 +22,12 @@
 
     <parent>
         <groupId>org.apache.camel</groupId>
-        <artifactId>camel-parent</artifactId>
+        <artifactId>tooling</artifactId>
         <version>4.8.0-SNAPSHOT</version>
-        <relativePath>../parent</relativePath>
     </parent>
 
-    <artifactId>tooling</artifactId>
-    <packaging>pom</packaging>
+    <artifactId>camel-enforcer-rules</artifactId>
 
-    <name>Camel :: Tooling</name>
-    <description>Camel Tooling</description>
-
-    <modules>
-        <module>parent</module>
-        <module>spi-annotations</module>
-        <module>camel-tooling-model</module>
-        <module>camel-util-json</module>
-        <module>camel-tooling-util</module>
-        <module>openapi-rest-dsl-generator</module>
-        <module>maven</module>
-        <module>camel-tooling-maven</module>
-    </modules>
-
-    <properties>
-    </properties>
+    <name>Camel :: Enforcer rules</name>
+    <description>Rules for Maven Enforcer plugin packaged in a jar, so that 
they can be reused by Camel Quarkus, Camel SpringBoot and other 
projects</description>
 </project>
diff --git 
a/tooling/enforcer-rules/src/main/resources/camel-banned-dependencies.xml 
b/tooling/enforcer-rules/src/main/resources/camel-banned-dependencies.xml
new file mode 100644
index 00000000000..0d108ab95e8
--- /dev/null
+++ b/tooling/enforcer-rules/src/main/resources/camel-banned-dependencies.xml
@@ -0,0 +1,29 @@
+<!--
+
+    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.
+
+-->
+<enforcer>
+    <rules>
+        <!-- Camel dependency bans -->
+        <bannedDependencies>
+            <excludes>
+                <exclude>com.sun.xml.bind:jaxb-core</exclude><!-- use 
org.glassfish.jaxb:jaxb-core instead -->
+                <exclude>com.sun.xml.bind:jaxb-impl</exclude><!-- use 
org.glassfish.jaxb:jaxb-runtime instead -->
+            </excludes>
+        </bannedDependencies>
+    </rules>
+</enforcer>
\ No newline at end of file
diff --git a/tooling/pom.xml b/tooling/pom.xml
index 64d71ff6d96..f3fb73d4243 100644
--- a/tooling/pom.xml
+++ b/tooling/pom.xml
@@ -42,6 +42,7 @@
         <module>openapi-rest-dsl-generator</module>
         <module>maven</module>
         <module>camel-tooling-maven</module>
+        <module>enforcer-rules</module>
     </modules>
 
     <properties>

Reply via email to