swagger-maven-example icon indicating copy to clipboard operation
swagger-maven-example copied to clipboard

error NullPointerException on compile with version 3.1.8

Open samuelfac opened this issue 5 years ago • 0 comments

up to version 3.1.7 the project compiles. With version 3.1.8 an "NullPointerException " error occurs.

Log:

[INFO] Scanning for projects...
[INFO] 
[INFO] ------------< swagger-maven-example:swagger-maven-example >-------------
[INFO] Building swagger-maven-example 1.0-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ swagger-maven-example ---
[INFO] Deleting C:\Users\samuelfac\Downloads\swagger-maven-example-master\target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ swagger-maven-example ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 2 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ swagger-maven-example ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 16 source files to C:\Users\samuelfac\Downloads\swagger-maven-example-master\target\classes
[INFO] 
[INFO] --- swagger-maven-plugin:3.1.8:generate (default) @ swagger-maven-example ---
11:56:51,762 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
11:56:51,762 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
11:56:51,762 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/C:/Users/samuelfac/Downloads/swagger-maven-example-master/target/classes/logback.xml]
11:56:51,810 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
11:56:51,814 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
11:56:51,817 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
11:56:51,852 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - This appender no longer admits a layout as a sub-component, set an encoder instead.
11:56:51,852 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - To ensure compatibility, wrapping your layout in LayoutWrappingEncoder.
11:56:51,852 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - See also http://logback.qos.ch/codes.html#layoutInsteadOfEncoder for details
11:56:51,852 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.wordnik] to DEBUG
11:56:51,852 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to DEBUG
11:56:51,852 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
11:56:51,853 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
11:56:51,854 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@7fbf26fc - Registering current configuration as safe fallback point

[INFO] Reflections took 63 ms to scan 1 urls, producing 3 keys and 9 values 
[INFO] Reflections took 4 ms to scan 1 urls, producing 3 keys and 9 values 
[INFO] Reflections took 4 ms to scan 1 urls, producing 3 keys and 9 values 
[INFO] Reflections took 4 ms to scan 1 urls, producing 3 keys and 9 values 
[INFO] Reflections took 3 ms to scan 1 urls, producing 3 keys and 9 values 
[INFO] Reflections took 3 ms to scan 1 urls, producing 3 keys and 9 values 
[INFO] Reflections took 5 ms to scan 1 urls, producing 6 keys and 18 values 
[INFO] Reflections took 9 ms to scan 1 urls, producing 6 keys and 18 values 
[INFO] Reflections took 5 ms to scan 1 urls, producing 6 keys and 18 values 
[INFO] Writing doc to C:\Users\samuelfac\Downloads\swagger-maven-example-master/generated/document.html...
[INFO] Done!
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.634 s
[INFO] Finished at: 2020-08-17T11:56:52+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.kongchen:swagger-maven-plugin:3.1.8:generate (default) on project swagger-maven-example: null: MojoExecutionException: NullPointerException -> [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

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>swagger-maven-example</groupId>
    <artifactId>swagger-maven-example</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>
    <build>
        <plugins>
            <plugin>
                <groupId>com.github.kongchen</groupId>
                <artifactId>swagger-maven-plugin</artifactId>
                <version>3.1.8</version>
                <configuration>
                    <apiSources>
                      <apiSource>
                            <springmvc>false</springmvc>
                            <locations>com.github.kongchen.swagger.sample.wordnik.resource</locations>
                            <schemes>http,https</schemes>
                            <host>petstore.swagger.wordnik.com</host>
                            <basePath>/api</basePath>
                            <info>
                                <title>Swagger Maven Plugin Sample</title>
                                <version>v1</version>
                                <description>This is a sample for swagger-maven-plugin</description>
                                <termsOfService>
                                    http://www.github.com/kongchen/swagger-maven-plugin
                                </termsOfService>
                                <contact>
                                    <email>[email protected]</email>
                                    <name>Kong Chen</name>
                                    <url>http://kongch.com</url>
                                </contact>
                                <license>
                                    <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
                                    <name>Apache 2.0</name>
                                </license>
                            </info>
                            <!-- Support classpath or file absolute path here.
                            1) classpath e.g: "classpath:/markdown.hbs", "classpath:/templates/hello.html"
                            2) file e.g: "${basedir}/src/main/resources/markdown.hbs",
                                "${basedir}/src/main/resources/template/hello.html" -->
                            <templatePath>${basedir}/templates/strapdown.html.hbs</templatePath>
                            <outputPath>${basedir}/generated/document.html</outputPath>
                            <swaggerDirectory>generated/swagger-ui</swaggerDirectory>
                            <securityDefinitions>
                                <securityDefinition>
                                    <json>/securityDefinitions.json</json>
                                </securityDefinition>
                            </securityDefinitions>
                        </apiSource>
                    </apiSources>
                </configuration>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.1.1</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-core</artifactId>
            <scope>compile</scope>
            <version>1.5.3</version>
            <exclusions>
                <exclusion>
                    <groupId>javax.ws.rs</groupId>
                    <artifactId>jsr311-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback-version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
            <version>${logback-version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.containers</groupId>
            <artifactId>jersey-container-servlet-core</artifactId>
            <version>${jersey2-version}</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.media</groupId>
            <artifactId>jersey-media-multipart</artifactId>
            <version>${jersey2-version}</version>
        </dependency>
    </dependencies>
    <properties>
        <jetty-version>9.0.7.v20131107</jetty-version>
        <jersey2-version>2.4.1</jersey2-version>
        <logback-version>1.0.1</logback-version>
    </properties>
    <pluginRepositories>
        <pluginRepository>
            <id>sonatype-snapshot</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>
</project>

command: mvn clean install

samuelfac avatar Aug 17 '20 09:08 samuelfac