Skip to content

Commit

Permalink
fix(jolokia): exclude com.sun:tools for broken jolokia-jvm pom
Browse files Browse the repository at this point in the history
  • Loading branch information
tadayosi committed Aug 26, 2021
1 parent 6684929 commit 45bcecb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
11 changes: 11 additions & 0 deletions pkg/util/camel/camel_dependencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 9 additions & 2 deletions pkg/util/maven/maven_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"`
Expand Down

0 comments on commit 45bcecb

Please sign in to comment.