You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ts...@apache.org on 2021/08/26 08:25:20 UTC

[camel-k] 02/02: fix(jolokia): exclude com.sun:tools for broken jolokia-jvm pom

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

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

commit 45bcecbeec7684a04434b8f999f1706f84f51617
Author: Tadayoshi Sato <sa...@gmail.com>
AuthorDate: Thu Aug 26 17:22:13 2021 +0900

    fix(jolokia): exclude com.sun:tools for broken jolokia-jvm pom
---
 pkg/util/camel/camel_dependencies.go | 11 +++++++++++
 pkg/util/maven/maven_project.go      | 11 +++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/pkg/util/camel/camel_dependencies.go b/pkg/util/camel/camel_dependencies.go
index 9f2c439..44b523e 100644
--- a/pkg/util/camel/camel_dependencies.go
+++ b/pkg/util/camel/camel_dependencies.go
@@ -89,6 +89,17 @@ func ManageIntegrationDependencies(
 			gav := strings.TrimPrefix(d, "mvn:")
 
 			project.AddEncodedDependencyGAV(gav)
+			// TODO hack for tools.jar dependency issue in jolokia-jvm
+			// this block should be removed once the jolokia-jvm pom issue
+			// is resolved
+			// https://github.com/rhuss/jolokia/issues/473
+			if strings.Contains(gav, "org.jolokia:jolokia-jvm") {
+				me := maven.Exclusion{
+					GroupID:    "com.sun",
+					ArtifactID: "tools",
+				}
+				project.AddEncodedDependencyExclusion(gav, me)
+			}
 		default:
 			if dep := jitpack.ToDependency(d); dep != nil {
 				project.AddDependency(*dep)
diff --git a/pkg/util/maven/maven_project.go b/pkg/util/maven/maven_project.go
index e9ed19d..ac1b86e 100644
--- a/pkg/util/maven/maven_project.go
+++ b/pkg/util/maven/maven_project.go
@@ -109,12 +109,12 @@ func (p *Project) AddDependencies(deps ...Dependency) {
 	}
 }
 
-// AddDependencyGAV a dependency to maven's dependencies
+// AddDependencyGAV adds a dependency to maven's dependencies
 func (p *Project) AddDependencyGAV(groupID string, artifactID string, version string) {
 	p.AddDependency(NewDependency(groupID, artifactID, version))
 }
 
-// AddEncodedDependencyGAV a dependency to maven's dependencies
+// AddEncodedDependencyGAV adds a dependency in GAV format to maven's dependencies
 func (p *Project) AddEncodedDependencyGAV(gav string) {
 	if d, err := ParseGAV(gav); err == nil {
 		// TODO: error handling
@@ -145,6 +145,13 @@ func (p *Project) AddDependencyExclusions(dep Dependency, exclusions ...Exclusio
 	}
 }
 
+func (p *Project) AddEncodedDependencyExclusion(gav string, exclusion Exclusion) {
+	if d, err := ParseGAV(gav); err == nil {
+		// TODO: error handling
+		p.AddDependencyExclusion(d, exclusion)
+	}
+}
+
 type propertiesEntry struct {
 	XMLName xml.Name
 	Value   string `xml:",chardata"`