Skip to content

Running plugin returns the error "Scanner SubTypesScanner was not configured" #96

Open
@rujiel

Description

@rujiel

Hello, I'm trying to set up automatic register of resources with this plugin, but having some difficulty getting it to work with Tomcat. When running mvn verify I'm getting the cryptic error "Scanner SubTypesScanner was not configured". It sounds like something is exploding when trying to use reflection.

I am currently trying with version 2.1.6 of the plugin. For version 1 of the plugin and swagger, the plugin ran properly but it outputted a swagger.json that was nearly empty, so I'm trying v2. I'm using JDK 17, here are the important parts of my pom and my classes, am I doing something majorly wrong?

A couple other questions
* is the swagger annotations dependency required for this to work?
* It used to be with BeanConfig I could tell it to automatically scan for resources, is there a way I need to do that for SwaggerConfiguration?


    <dependency>
        <groupId>io.swagger.core.v3</groupId>
        <artifactId>swagger-jaxrs2</artifactId>
        <version>2.2.0</version>
    </dependency>

  <plugin>
	<groupId>io.openapitools.swagger</groupId>
	<artifactId>swagger-maven-plugin</artifactId>
	<version>2.1.6</version>
	<configuration>
	  <resourcePackages>
		<resourcePackage>org.xyz.boundary</resourcePackage>
	  </resourcePackages>
	  <outputDirectory>${basedir}/target/</outputDirectory>
	  <outputFilename>swagger</outputFilename>
	  <outputFormats>JSON</outputFormats>
	  <prettyPrint>true</prettyPrint>
	</configuration>
	<executions>
	  <execution>
		<goals>
		  <goal>generate</goal>
		</goals>
	  </execution>
	</executions>
  </plugin>

My resource

	@Path("/test")
	@Tag(name = "test", description = "test")
	public class TestResource {
		@GET
		@Operation(summary = "do ting")
		@Produces("application/json")
		public ThingDO getThing() {
			return new ThingDO("testy");
		}
	}

Application config

	@ApplicationPath("/rs")
	public class ApplicationConfig extends Application {
		public ApplicationConfig(@Context ServletConfig config) {
			OpenAPI bc = new OpenAPI();
			Info info = new Info()
				.title("Test")
				.description("better")
				.contact(new Contact().email("[email protected]"))
				.version("1.0");
			bc.info(info);
			SwaggerConfiguration oasConfig = new SwaggerConfiguration()
				.openAPI(bc)
				.prettyPrint(true)
				.resourcePackages(Set.of("org.xyz.boundary"));
			try {
				new JaxrsOpenApiContextBuilder()
	//                .servletConfig(servletConfig)
					.application(this)
					.openApiConfiguration(oasConfig)
					.buildContext(true);
			} catch (OpenApiConfigurationException e) {
				throw new RuntimeException(e.getMessage(), e);
			}
		}
	}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions