Fix #635 Dependency parity check
diff --git a/extensions/ahc/deployment/pom.xml b/extensions/ahc/deployment/pom.xml
index b1ca2bc..6dacfd0 100644
--- a/extensions/ahc/deployment/pom.xml
+++ b/extensions/ahc/deployment/pom.xml
@@ -50,6 +50,10 @@
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-http-common-deployment</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-support-ahc-deployment</artifactId>
</dependency>
<dependency>
diff --git a/extensions/core-cloud/deployment/pom.xml b/extensions/core-cloud/deployment/pom.xml
index 4b8ebb6..5463232 100644
--- a/extensions/core-cloud/deployment/pom.xml
+++ b/extensions/core-cloud/deployment/pom.xml
@@ -43,6 +43,10 @@
<dependencies>
<dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-caffeine-deployment</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-core-deployment</artifactId>
</dependency>
diff --git a/extensions/core/runtime/pom.xml b/extensions/core/runtime/pom.xml
index f3e2548..1cc0f51 100644
--- a/extensions/core/runtime/pom.xml
+++ b/extensions/core/runtime/pom.xml
@@ -60,6 +60,10 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-caffeine</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-support-common</artifactId>
+ </dependency>
<!-- camel -->
<dependency>
diff --git a/extensions/ftp/runtime/pom.xml b/extensions/ftp/runtime/pom.xml
index 0a308b6..63654db 100644
--- a/extensions/ftp/runtime/pom.xml
+++ b/extensions/ftp/runtime/pom.xml
@@ -58,6 +58,10 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jsch</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-file</artifactId>
+ </dependency>
</dependencies>
<build>
diff --git a/extensions/kotlin/deployment/pom.xml b/extensions/kotlin/deployment/pom.xml
index 21d236f..e7b47cd 100644
--- a/extensions/kotlin/deployment/pom.xml
+++ b/extensions/kotlin/deployment/pom.xml
@@ -42,8 +42,8 @@
<dependencies>
<dependency>
- <groupId>io.quarkus</groupId>
- <artifactId>quarkus-core-deployment</artifactId>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-core-deployment</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
diff --git a/extensions/kotlin/runtime/pom.xml b/extensions/kotlin/runtime/pom.xml
index 27a357b..b927e24 100644
--- a/extensions/kotlin/runtime/pom.xml
+++ b/extensions/kotlin/runtime/pom.xml
@@ -51,6 +51,10 @@
<artifactId>camel-core-engine</artifactId>
</dependency>
<dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-core</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
</dependency>
diff --git a/extensions/servlet/deployment/pom.xml b/extensions/servlet/deployment/pom.xml
index 90c8543..31827c9 100644
--- a/extensions/servlet/deployment/pom.xml
+++ b/extensions/servlet/deployment/pom.xml
@@ -43,10 +43,6 @@
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
- <artifactId>quarkus-vertx-http-deployment</artifactId>
- </dependency>
- <dependency>
- <groupId>io.quarkus</groupId>
<artifactId>quarkus-undertow-deployment</artifactId>
</dependency>
<dependency>
diff --git a/extensions/support/aws/deployment/pom.xml b/extensions/support/aws/deployment/pom.xml
index 35fbd6e..c37a647 100644
--- a/extensions/support/aws/deployment/pom.xml
+++ b/extensions/support/aws/deployment/pom.xml
@@ -48,6 +48,10 @@
<artifactId>camel-quarkus-core-deployment</artifactId>
</dependency>
<dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-jackson-deployment</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-support-aws</artifactId>
</dependency>
diff --git a/extensions/support/aws/runtime/pom.xml b/extensions/support/aws/runtime/pom.xml
index e7a2d40..2b1d1c4 100644
--- a/extensions/support/aws/runtime/pom.xml
+++ b/extensions/support/aws/runtime/pom.xml
@@ -48,8 +48,8 @@
<dependencies>
<dependency>
- <groupId>io.quarkus</groupId>
- <artifactId>quarkus-core</artifactId>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-core</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
diff --git a/extensions/support/spring/deployment/pom.xml b/extensions/support/spring/deployment/pom.xml
index 2bdadd8..7810e51 100644
--- a/extensions/support/spring/deployment/pom.xml
+++ b/extensions/support/spring/deployment/pom.xml
@@ -49,6 +49,10 @@
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-support-commons-logging-deployment</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-support-spring</artifactId>
+ </dependency>
</dependencies>
<build>
diff --git a/extensions/support/xml/deployment/pom.xml b/extensions/support/xml/deployment/pom.xml
index 61f3a18..8765f52 100644
--- a/extensions/support/xml/deployment/pom.xml
+++ b/extensions/support/xml/deployment/pom.xml
@@ -46,6 +46,10 @@
<artifactId>quarkus-core-deployment</artifactId>
</dependency>
<dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-jaxb-deployment</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-support-xml</artifactId>
</dependency>
diff --git a/tooling/scripts/validate-dependencies.groovy b/tooling/scripts/validate-dependencies.groovy
index 360a806..220ad67 100644
--- a/tooling/scripts/validate-dependencies.groovy
+++ b/tooling/scripts/validate-dependencies.groovy
@@ -14,9 +14,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+import java.nio.file.Path
+import java.nio.file.Paths
+
final List<String> badDeps = []
+final List<String> parityViolations = []
final File pomXml = new File(project.basedir, "pom.xml")
+/* groupIds that contain extensions */
+final Set<String> extensionGroupIds = ["org.apache.camel.quarkus", "io.quarkus"] as Set
+/* artifactIds from groups contained in extensionGroupIds that are not extensions */
+final Set<String> nonExtensionArtifactIds = [] as Set
+
+final Path treeRootDir = Paths.get(project.properties['camel.quarkus.project.root'])
+final Path relativePomPath = treeRootDir.relativize(pomXml.toPath().normalize())
+
if (pomXml.exists()) {
def pomXmlProject = new XmlParser().parseText(pomXml.getText('UTF-8'))
pomXmlProject.dependencies.dependency
@@ -24,11 +36,81 @@
!it.version.text().isEmpty()
}
.each {
- badDeps << "in ${project.basedir}/pom.xml : ${it.groupId.text()}:${it.artifactId.text()}"
+ badDeps << "in ${relativePomPath} : ${it.groupId.text()}:${it.artifactId.text()}"
}
+
+ /* Enforce the dependency parity between runtime and deployment modules */
+ final String deploymentArtifactId = pomXmlProject.artifactId.text()
+ if (isDeploymentArtifactId(deploymentArtifactId)) {
+ final String runtimeArtifactId = toRuntimeArtifactId(deploymentArtifactId)
+
+ if (pomXmlProject.dependencies.dependency.findAll { runtimeArtifactId.equals(it.artifactId.text()) }.size() == 0) {
+ parityViolations << "${relativePomPath} must depend on ${runtimeArtifactId}"
+ }
+
+ final Set<Tuple2> expectedRuntimeDeps = [] as LinkedHashSet
+ pomXmlProject.dependencies.dependency
+ .findAll {
+ isDeploymentArtifactId(it.artifactId.text()) && !it.scope
+ }
+ .each {
+ expectedRuntimeDeps.add(new Tuple2(it.groupId.text(), toRuntimeArtifactId(it.artifactId.text())))
+ }
+
+ final Set<Tuple2> actualRuntimeDeps = [] as LinkedHashSet
+ final File runtimePomXml = new File(project.basedir, "../runtime/pom.xml")
+
+ final Path relativeRuntimePomPath = treeRootDir.relativize(runtimePomXml.toPath().toAbsolutePath().normalize())
+
+ def runtimeProject = new XmlParser().parseText(runtimePomXml.getText('UTF-8'))
+ runtimeProject.dependencies.dependency
+ .findAll {
+ extensionGroupIds.contains(it.groupId.text()) &&
+ !nonExtensionArtifactIds.contains(it.artifactId.text()) &&
+ !it.scope
+ }
+ .each {
+ actualRuntimeDeps.add(new Tuple2(it.groupId.text(), it.artifactId.text()))
+ }
+
+ // println "expectedRuntimeDeps: " + expectedRuntimeDeps
+ // println "actualRuntimeDeps: " + actualRuntimeDeps
+
+ expectedRuntimeDeps
+ .findAll {
+ !actualRuntimeDeps.contains(it)
+ }
+ .each {
+ parityViolations << "${relativeRuntimePomPath} is missing ${it.first}:${it.second} dependency?"
+ }
+
+ actualRuntimeDeps
+ .findAll {
+ !expectedRuntimeDeps.contains(it)
+ }
+ .each {
+ parityViolations << "${relativePomPath} is missing ${it.first}:${it.second}-deployment dependency?"
+ }
+
+ }
}
-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 "))
+if (!badDeps.isEmpty() || !parityViolations.isEmpty()) {
+ final StringBuilder msg = new StringBuilder()
+ if (!badDeps.isEmpty()) {
+ msg.append("\nRemove explicit version from the following dependencies and rather manage them in one of the BOMs:\n\n "
+ + badDeps.join("\n "))
+ }
+ if (!parityViolations.isEmpty()) {
+ msg.append("\nViolations in the parity between deployment module dependencies and runtime module dependencies:\n\n "
+ + parityViolations.join("\n "))
+ }
+ throw new RuntimeException(msg.toString())
+}
+
+boolean isDeploymentArtifactId(String artifactId) {
+ return artifactId.endsWith("-deployment")
+}
+String toRuntimeArtifactId(String deploymentArtifactId) {
+ return deploymentArtifactId.substring(0, deploymentArtifactId.length() - "-deployment".length())
}
\ No newline at end of file