Apicurio / apicurio-registry

An API/Schema registry - stores APIs and Schemas.
https://www.apicur.io/registry/
Apache License 2.0
581 stars 259 forks source link

Cannot build exportConfluent #3601

Closed viscory closed 11 months ago

viscory commented 1 year ago

Description

ExportConfluent util Version: latest

Running the build command as stated by the README yields this

`❯ mvn package -Pprod
[INFO] Scanning for projects...
[INFO] 
[INFO] --------< io.apicurio:apicurio-registry-utils-exportConfluent >---------
[INFO] Building apicurio-registry-utils-exportConfluent 3.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for io.apicurio:apicurio-registry-utils-import-export:jar:3.0.0-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.584 s
[INFO] Finished at: 2023-08-25T10:33:37+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project apicurio-registry-utils-exportConfluent: Could not resolve dependencies for project io.apicurio:apicurio-registry-utils-exportConfluent:jar:3.0.0-SNAPSHOT: Failure to find io.apicurio:apicurio-registry-utils-import-export:jar:3.0.0-SNAPSHOT in https://packages.confluent.io/maven/ was cached in the local repository, resolution will not be reattempted until the update interval of confluent has elapsed or updates are forced -> [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/DependencyResolutionException`

I dont see a version titled 3.0.0-SNAPSHOT in any of the jar repos online (just 3.0.0-M1/M2), When I edited those versions into the pom.xml file and tried to build, I got this error

`[WARNING] Error injecting: io.quarkus.maven.BuildMojo
com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) No implementation for io.quarkus.maven.QuarkusBootstrapProvider was bound.
  while locating io.quarkus.maven.BuildMojo

1 error
    at com.google.inject.internal.InternalProvisionException.toProvisionException (InternalProvisionException.java:226)
    at com.google.inject.internal.InjectorImpl$1.get (InjectorImpl.java:1053)
    at com.google.inject.internal.InjectorImpl.getInstance (InjectorImpl.java:1086)
    at org.eclipse.sisu.space.AbstractDeferredClass.get (AbstractDeferredClass.java:48)
    at com.google.inject.internal.ProviderInternalFactory.provision (ProviderInternalFactory.java:85)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision (InternalFactoryToInitializableAdapter.java:57)
    at com.google.inject.internal.ProviderInternalFactory$1.call (ProviderInternalFactory.java:66)
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:112)
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:127)
    at com.google.inject.internal.ProvisionListenerStackCallback.provision (ProvisionListenerStackCallback.java:66)
    at com.google.inject.internal.ProviderInternalFactory.circularGet (ProviderInternalFactory.java:61)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.get (InternalFactoryToInitializableAdapter.java:47)
    at com.google.inject.internal.InjectorImpl$1.get (InjectorImpl.java:1050)
    at org.eclipse.sisu.inject.Guice4$1.get (Guice4.java:162)
    at org.eclipse.sisu.inject.LazyBeanEntry.getValue (LazyBeanEntry.java:81)
    at org.eclipse.sisu.plexus.LazyPlexusBean.getValue (LazyPlexusBean.java:51)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup (DefaultPlexusContainer.java:263)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup (DefaultPlexusContainer.java:255)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo (DefaultMavenPluginManager.java:519)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:124)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:104)
    at java.lang.reflect.Method.invoke (Method.java:578)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.436 s
[INFO] Finished at: 2023-08-25T10:36:19+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:3.0.4.Final:build (default) on project apicurio-registry-utils-exportConfluent: Execution default of goal io.quarkus:quarkus-maven-plugin:3.0.4.Final:build failed: Unable to load the mojo 'build' (or one of its required components) from the plugin 'io.quarkus:quarkus-maven-plugin:3.0.4.Final': com.google.inject.ProvisionException: Unable to provision, see the following errors:
[ERROR] 
[ERROR] 1) No implementation for io.quarkus.maven.QuarkusBootstrapProvider was bound.
[ERROR]   while locating io.quarkus.maven.BuildMojo
[ERROR]   at ClassRealm[plugin>io.quarkus:quarkus-maven-plugin:3.0.4.Final, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@1cf4f579] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
[ERROR]   while locating org.apache.maven.plugin.Mojo annotated with @com.google.inject.name.Named(value="io.quarkus:quarkus-maven-plugin:3.0.4.Final:build")
[ERROR] 
[ERROR] 1 error
[ERROR]       role: org.apache.maven.plugin.Mojo
[ERROR]   roleHint: io.quarkus:quarkus-maven-plugin:3.0.4.Final:build
[ERROR] -> [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/PluginContainerException
`

I think with 3.0.0.M1, I got this:

`[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project apicurio-registry-utils-exportConfluent: Compilation failure: Compilation failure: 
[ERROR] /home/fuz/code/apicurio-registry/utils/exportConfluent/src/main/java/io/apicurio/registry/utils/export/Export.java:[59,22] package jakarta.inject does not exist
[ERROR] /home/fuz/code/apicurio-registry/utils/exportConfluent/src/main/java/io/apicurio/registry/utils/export/mappers/ArtifactReferenceMapper.java:[6,22] package jakarta.inject does not exist
[ERROR] /home/fuz/code/apicurio-registry/utils/exportConfluent/src/main/java/io/apicurio/registry/utils/export/mappers/ArtifactReferenceMapper.java:[8,2] cannot find symbol
[ERROR]   symbol: class Singleton
[ERROR] /home/fuz/code/apicurio-registry/utils/exportConfluent/src/main/java/io/apicurio/registry/utils/export/Export.java:[71,6] cannot find symbol
[ERROR]   symbol:   class Inject
[ERROR]   location: class io.apicurio.registry.utils.export.Export
[ERROR] /home/fuz/code/apicurio-registry/utils/exportConfluent/src/main/java/io/apicurio/registry/utils/export/Export.java:[74,6] cannot find symbol
[ERROR]   symbol:   class Inject
[ERROR]   location: class io.apicurio.registry.utils.export.Export
[ERROR] -> [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/MojoFailureException
`

By adding

`<!-- https://mvnrepository.com/artifact/jakarta.inject/jakarta.inject-api -->
<dependency>
    <groupId>jakarta.inject</groupId>
    <artifactId>jakarta.inject-api</artifactId>
    <version>2.0.1</version>
</dependency>
`

to the pom.xml, The jar did build successfully but I got this error:

❯ java -jar target/apicurio-registry-utils-exportConfluent-3.0.0.M1-runner.jar http://localhost:35569
Exception in thread "main" java.lang.ExceptionInInitializerError
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:70)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
    at io.quarkus.runner.GeneratedMain.main(Unknown Source)
Caused by: java.lang.RuntimeException: Failed to start quarkus
    at io.quarkus.runner.ApplicationImpl.<clinit>(Unknown Source)
    ... 8 more
Caused by: java.lang.NoClassDefFoundError: javax/inject/Provider
    at java.base/java.lang.ClassLoader.defineClass1(Native Method)
    at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1012)
    at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
    at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:862)
    at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760)
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681)
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
    at io.quarkus.arc.impl.ArcContainerImpl.addBuiltInBeans(ArcContainerImpl.java:455)
    at io.quarkus.arc.impl.ArcContainerImpl.<init>(ArcContainerImpl.java:138)
    at io.quarkus.arc.Arc.initialize(Arc.java:31)
    at io.quarkus.arc.runtime.ArcRecorder.initContainer(ArcRecorder.java:43)
    at io.quarkus.deployment.steps.ArcProcessor$generateResources844392269.deploy_0(Unknown Source)
    at io.quarkus.deployment.steps.ArcProcessor$generateResources844392269.deploy(Unknown Source)
    ... 9 more
Caused by: java.lang.ClassNotFoundException: javax.inject.Provider
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
    ... 24 more

Please help.

Environment

uname -a: Linux 6.2.0-26-generic #26~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jul 13 16:27:29 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Steps to Reproduce

Expected vs Actual Behaviour

Expected the utility to just build successfully

Logs

apicurio-bot[bot] commented 1 year ago

Thank you for reporting an issue!

Pinging @EricWittmann to respond or triage.

EricWittmann commented 1 year ago

Hi thanks for the report. We'll need to update the readme for the export tool, since what you're trying to do will definitely not work (as you've discovered).

If you want to build that tool today, you will need to do a mvn clean package from the root of the apicurio-registry repository.

EricWittmann commented 1 year ago

Out of curiosity - why do you need to build a snapshot version of the tool rather than grabbing a pre-built jar from maven central? For example, is the current tool not working as it should? :)

(also we should probably attach the built export utility to the GitHub release - we'll work on that!)

viscory commented 1 year ago

Thank you for responding. To answer your questions in order. I actually was able to build it. I changed the version to 3.0.0.M2. I was getting some quarkus plugin errors (which turned out to be an issue with my Maven version (requires 3.6.3++)

I had actually used the pre built jar from maven central after posting this issue and used it to export the schema registry from my confluent schema registry to my apicurio registry

in both cases, using both tools, there were some schemas that were not replicated properly. I could provide more details on that in a separate issue.

carlesarnal commented 1 year ago

Hello @viscory, yes, please. If you're experiencing any problem, please, create an issue as you see fit.

viscory commented 11 months ago

Managed to rebuild it

As a warning to anyone trying to use this tool. Understand that the schema IDs do not get imported into apicurio properly (mismatches). Our kafka connectors were failing and we decided to switch back to confluent schema registry