kongchen / swagger-maven-plugin

JAX-RS & SpringMVC supported maven build plugin, helps you generate Swagger JSON and API document in build phase.
http://kongchen.github.io/swagger-maven-plugin/
Apache License 2.0
763 stars 451 forks source link

Error with newer Java Version: could not get type for name #878

Open S-Heinrich-de opened 2 years ago

S-Heinrich-de commented 2 years ago

Hi guys,

i get an error "could not get type for name" on com.github.kongchen.swagger.docgen.mavenplugin.ApiSource.getValidClasses() when i try to package my war with Java 11. With java 1.8 i have no issues.

Anyone else? Have you some workarounds or tipps?

Stacktrace:

[ERROR] Failed to execute goal com.github.kongchen:swagger-maven-plugin:3.1.8:generate (default) on project [...myProject...]: could not get type for name [...myController...] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.kongchen:swagger-maven-plugin:3.1.8:generate (default) on project [...myProjekct...].: could not get type for name [...myController...]
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
    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:972)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:196)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoExecutionException: could not get type for name [...myController...]
    at com.github.kongchen.swagger.docgen.mavenplugin.ApiDocumentMojo.execute(ApiDocumentMojo.java:152)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
    ... 20 more
Caused by: org.reflections.ReflectionsException: could not get type for name [...myController...]
    at org.reflections.ReflectionUtils.forName(ReflectionUtils.java:389)
    at org.reflections.Reflections$2.apply(Reflections.java:414)
    at org.reflections.Reflections$2.apply(Reflections.java:412)
    at com.google.common.base.Predicates$AndPredicate.apply(Predicates.java:384)
    at com.google.common.collect.Iterators$6.computeNext(Iterators.java:617)
    at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:145)
    at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:140)
    at com.google.common.collect.Iterators.addAll(Iterators.java:366)
    at com.google.common.collect.Sets.newHashSet(Sets.java:240)
    at com.google.common.collect.Sets.newHashSet(Sets.java:221)
    at org.reflections.ReflectionUtils.filter(ReflectionUtils.java:454)
    at org.reflections.Reflections.getAllAnnotated(Reflections.java:412)
    at org.reflections.Reflections.getTypesAnnotatedWith(Reflections.java:384)
    at com.github.kongchen.swagger.docgen.mavenplugin.ApiSource.getValidClasses(ApiSource.java:159)
    at com.github.kongchen.swagger.docgen.AbstractDocumentSource.getValidClasses(AbstractDocumentSource.java:420)
    at com.github.kongchen.swagger.docgen.mavenplugin.MavenDocumentSource.getValidClasses(MavenDocumentSource.java:32)
    at com.github.kongchen.swagger.docgen.AbstractDocumentSource.loadDocuments(AbstractDocumentSource.java:108)
    at com.github.kongchen.swagger.docgen.mavenplugin.ApiDocumentMojo.execute(ApiDocumentMojo.java:122)
    ... 22 more
sandeepthaker commented 3 months ago

I am also getting the same error while generating swagger documentation. Did you get any solution? Thanks