Skip to content

KafkaConnect build does not use custom repository for maven dependency #8087

Open
@cyrmue

Description

@cyrmue

Describe the bug
When specifying a custom repository for a maven dependency in the build section of a KafkaConnect resource, the custom repository it is not used for all dependencies. We have no direct internet connection to any repository (we need to "proxy" all download of all dependencies)

To Reproduce
Steps to reproduce the behavior:

  1. Create a KafkaConnect resource like the following:
apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaConnect
metadata:
  name: test
spec:
  replicas: 1
  bootstrapServers: kafka-bootstrap:9092
  build:
    output:
      type: docker
      image: <internalRegistry>
      pushSecret: <pushCredential>
    plugins:
      - name: elastic-sink
        artifacts:
          - type: maven
            repository: https://<ourRepoServer>/remote-repos/
            group: io.confluent
            artifact: kafka-connect-elasticsearch
            version: 14.0.2

2 . See error

Downloading from custom-repo: https://<ourRepoServer>/remote-repos/com/fasterxml/oss-parent/43/oss-parent-43.pom
Downloaded from custom-repo: https://<ourRepoServer>/remote-repos/com/fasterxml/oss-parent/43/oss-parent-43.pom (24 kB at 1.6 MB/s)
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: commons-codec:commons-codec:jar -> duplicate declaration of version 1.15 @ line 121, column 21
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: commons-codec:commons-codec:jar -> version 1.15 vs ${commons.codec.version} @ line 126, column 21
[ERROR] Unresolveable build extension: Plugin kr.motd.maven:os-maven-plugin:1.6.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for kr.motd.maven:os-maven-plugin:jar:1.6.2 @
 @
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR]   The project io.confluent:kafka-connect-elasticsearch:14.0.2 (/tmp/elastic-sink/0242b419/pom.xml) has 1 error
[ERROR]     Unresolveable build extension: Plugin kr.motd.maven:os-maven-plugin:1.6.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for kr.motd.maven:os-maven-plugin:jar:1.6.2: Could not transfer artifact kr.motd.maven:os-maven-plugin:pom:1.6.2 from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/kr/motd/maven/os-maven-plugin/1.6.2/os-maven-plugin-1.6.2.pom: Unknown host repo.maven.apache.org: Name or service not known -> [Help 2]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:

Expected behavior
All downloads should use the repository URL.

Environment (please complete the following information):

  • Strimzi version: 0.33.1
  • Installation method: Helm chart
  • Kubernetes cluster: 1.23
  • Infrastructure: On-premise cluster

Additional context
We thought it would be fixed with:
#7259
#7676

But in our case the settings.xml should not be with profile but with mirror. Something like:
KafkaConnectDockerfile.java Line 159

String settingsXml =  "<settings xmlns=\"http://maven.apache.org/SETTINGS/1.0.0\"><mirrors><mirror><id>customRepo</id><mirrorOf>*</mirrorOf><url>" + escapeXml(repo) + "</url></mirror></mirrors></settings>";

Mirror settings in maven doc
=> "You want to replace a particular repository with your own internal repository which you have greater control over".

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions