strimzi / strimzi-kafka-oauth

OAuth2 support for Apache Kafka® to work with many OAuth2 authorization servers
Apache License 2.0
140 stars 89 forks source link

fix: guide example docker Readme kafka-oauth-strimzi #237

Open flo-kn opened 4 months ago

flo-kn commented 4 months ago

Blindly following the guide would produce this error when trying to mvn clean package:

User
how to fix? [INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.563 s
[INFO] Finished at: 2024-04-21T22:26:48+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.1.1:copy (copy) on project kafka-oauth-docker-strimzi-kafka: Unable to find/resolve artifact.: The following artifacts could not be resolved: io.strimzi:kafka-oauth-client:jar:1.0.0-SNAPSHOT (absent): Could not find artifact io.strimzi:kafka-oauth-client:jar:1.0.0-SNAPSHOT -> [Help 1]
[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:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :kafka-oauth-docker-strimzi-kafka

Maven will complain about missing artifacts.

flo-kn commented 4 months ago

Made a PR#236 to fix this but rather would get some guidance on proper usage

mstruk commented 4 months ago

The issue here is that the examples/docker/strimzi-kafka-image/README.md leads you to believe that you should run mvn clean package in examples/docker/strimzi-kafka-image directory. In fact you should run that command in the project root directory first, followed by running the same in examples/docker directory.

Then you should always run the docker-compose commands from examples/docker directory. There is a docker examples README.md in examples/docker which is probably the only one we should keep and merge the information of all the other READMEs into that one, removing the others.

flo-kn commented 4 months ago

Thanks for the feedback in here and the help on the PR https://github.com/strimzi/strimzi-kafka-oauth/pull/236. Was able to make it work in my environment without the need to adjust the pom.xml files following these steps:

gh repo clone strimzi/strimzi-kafka-oauth
git fetch --tags
git checkout 0.15.0 # pick the latest release instead of latest development version (main)
cd examples/docker 
mvn clean install # install relying on parent POM referencing public maven artifacts from latest release, in this case version 0.15.0
docker rm -f kafka zookeeper keycloak spring
docker-compose -f compose.yml -f kafka-oauth-strimzi/compose.yml -f keycloak/compose.yml up --build