Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate failed: Cannot invoke "java.util.Map.size()" because "map" is null #109

Open
dorus-private opened this issue Jan 19, 2023 · 6 comments

Comments

@dorus-private
Copy link

Describe the bug
After configured the plugin in my pom.xml, by invoking "mvn clean install" the build is falling with the following error:

[ERROR] Failed to execute goal io.openapitools.swagger:swagger-maven-plugin:2.1.5:generate (default) on project IBANValidator: Execution default of goal io.openapitools.swagger:swagger-maven-plugin:2.1.5:generate failed: Cannot invoke "java.util.Map.size()" because "map" is null

To Reproduce
I am using java 17 and the following plugin configuration:

            <plugin>
                <groupId>io.openapitools.swagger</groupId>
                <artifactId>swagger-maven-plugin</artifactId>
                <version>${swagger.maven.plugin}</version>
                <configuration>
                    <resourcePackages>
                        <resourcePackage>com.mypackage.restcontroller</resourcePackage>
                    </resourcePackages>
                    <outputDirectory>${basedir}/target/</outputDirectory>
                    <outputFilename>swagger.out</outputFilename>
                    <outputFormats>JSON,YAML</outputFormats>
                    <prettyPrint>true</prettyPrint>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

swagger.maven.plugin has value 2.1.5, the same is happening for version 2.1.6.

Expected behavior
I expected to have 2 generated files.

Additional context

@lehnert-andre
Copy link

Hi, have the same problem after updating to Jakarta EE 10.

[ERROR] Failed to execute goal io.openapitools.swagger:swagger-maven-plugin:2.1.6:generate (default) on project <project-placeholder>: Execution default of goal io.openapitools.swagger:swagger-maven-plugin:2.1.6:generate failed: Cannot invoke "java.util.Map.size()" because "map" is null -> [Help 1]

I´m using the Wildfly BOM

<dependency>
  <groupId>org.wildfly.bom</groupId>
  <artifactId>wildfly-ee</artifactId>
  <version>27.0.1.Final</version>
  <type>pom</type>
  <scope>import</scope>
</dependency>

with JAX-RS

 <dependency>
  <groupId>jakarta.ws.rs</groupId>
  <artifactId>jakarta.ws.rs-api</artifactId>
  <scope>provided</scope>
</dependency>

@ShubhamShekhar1996
Copy link

Is there any update on this issue?

@htr3n
Copy link

htr3n commented Nov 6, 2023

Got the same error with the plugin when using Jakarta. It seems the plugin is built or linked against Java EE as I ran the specific plugin goal as following

mvn io.openapitools.swagger:swagger-maven-plugin:generate

got this exception

[ERROR] Failed to execute goal io.openapitools.swagger:swagger-maven-plugin:2.1.5:generate (default-cli) on project swagger-jakarta: Execution default-cli of goal io.openapitools.swagger:swagger-maven-plugin:2.1.5:generate failed: A required class was missing while executing io.openapitools.swagger:swagger-maven-plugin:2.1.5:generate: javax/servlet/ServletConfig

Updated: I looked into the POM, it seems to use Java EE JAX-RS instead of Jakarta EE JAX-RS.

@nobody102
Copy link

Any update on this?

@salake
Copy link

salake commented Nov 15, 2023

I'm getting the same error

@sofyenne
Copy link

sofyenne commented Jun 9, 2024

I have resolved this issue by replacing the true and the by the path to your rest class

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants