Code Monkey home page Code Monkey logo

swagger-maven-example's People

Contributors

kongchen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swagger-maven-example's Issues

XmlAttribute is ignored

I have one class with the annotation @XmlAttribute in some properties but the generated swagger doesn´t contain this
xml:
attribute: true

I don´t know if this is a bug.

Plugin execution not covered by lifecycle configuration

This looks pretty promising, but I don't get it to work. I get these errors in the pom.xml in Eclipse.

Plugin execution not covered by lifecycle configuration: com.github.kongchen:swagger-maven-plugin:2.0:generate (execution: default, phase: compile) pom.xml /swagger-maven-example line 81 Maven Project Build Lifecycle Mapping Problem

Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-antrun-plugin:1.7:run (execution: default, phase: compile) pom.xml /swagger-maven-example line 36 Maven Project Build Lifecycle Mapping Problem

On StackOverflow I found for similar errors that it would help when I add a . I tried and it removes the compile errors but then when I run the compiler it tells me that there are no goals defined.

Any help is appreciated! Thanks

Usage behind a proxy

I am trying to use the plugin behind a proxy, so basically the GET requests to the mustache markdown and template are not working.

I downloaded the files and tried a file:// URL but this wont work too.

This plug-in cannot collect interface information

When I use this plug-in in my project, I can't generate a complete Swagger object, and it can't analyze the package path in my project by Reflections. How did you solve this problem, or do you have any ideas?

Problem with generated resource model definition for model with generic type

Hello
I have a model class named MyCustomModel<P extends Pet, T extends Tag, U extends User> and i implemented a resource for it (see example in attached zip):

@Path("/custom")
@Api(value = "/custom", description = "Operations about custom model")
@Produces({"application/json", "application/xml"})
public class MyCustomResource {


    @POST
    @ApiOperation(value = "Create custom model",
            notes = "This creates a custom model",
            position = 1)
    public Response createCustom(
            @ApiParam(value = "Created custom model", required = true) MyCustomModel<Pet, SubTag, User> model) {

        return Response.ok().entity("").build();
    }
}

The generated documentation of my resource looks like this:

image

image

Is this a normal behaviour of the plugin?

It would be better to generate the resource model with the same class name (MyCustomModel) but not MyCustomModelPerSubTagUser).

Thank you.

The sample is here :
swagger-maven-example.zip

Override swagger:generate goal

Hi,

As this plugin run when we execute mvn swagger:generate, how is it possible to run in this plugin mvn clean install phase?

Thanks

Cannot compile the project

Hi folks:

I always got error when I try to compile the project....

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building swagger-maven-example 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ swagger-maven-example ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/f552189/IdeaProjects/swagger-maven-example-master/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ swagger-maven-example ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-antrun-plugin:1.7:run (default) @ swagger-maven-example ---
[INFO] Executing tasks

get markdown.mustache:
[get] Getting: https://raw.github.com/kongchen/api-doc-template/master/v2.0/markdown.mustache
[get] To: /Users/f552189/IdeaProjects/swagger-maven-example-master/markdown.mustache
[get] Error getting https://raw.github.com/kongchen/api-doc-template/master/v2.0/markdown.mustache to /Users/f552189/IdeaProjects/swagger-maven-example-master/markdown.mustache
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:16.300s
[INFO] Finished at: Wed Mar 12 15:08:21 EDT 2014
[INFO] Final Memory: 10M/156M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (default) on project swagger-maven-example: An Ant BuildException has occured: java.net.ConnectException: Operation timed out
[ERROR] around Ant part ...... @ 4:17 in /Users/f552189/IdeaProjects/swagger-maven-example-master/target/antrun/build-get markdown.mustache.xml
[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/MojoExecutionException

  1. If I download the markdown.mustache manually and put it under
    swagger-maven-example and in the pom.xml

    I comment out
    plugin
    artifactId maven-antrun-plugin /artifactId
    version 1.7 /version
    executions
    execution
    phase compile /phase
    configuration
    target name="get markdown.mustache"
    get dest="."
    url url="https://raw.github.com/kongchen/api-doc-template/master/v2.0/markdown.mustache"/
    /get
    /target
    /configuration
    goals
    goal run /goal
    /goals
    /execution
    /executions
    /plugin

then, I got this error:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building swagger-maven-example 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ swagger-maven-example ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/f552189/IdeaProjects/swagger-maven-example-master/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ swagger-maven-example ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 13 source files to /Users/f552189/IdeaProjects/swagger-maven-example-master/target/classes
[INFO]
[INFO] --- swagger-maven-plugin:2.0:generate (default) @ swagger-maven-example ---
[INFO] Detect Resource:com.foo.bar.api.garage.GarageResourceV1
[INFO] Detect Resource:com.foo.bar.api.car.CarResourceV1
[INFO] Detect Resource:com.foo.bar.api.car.CarResourceV2
[INFO] Writing doc to generated/strapdown.html...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:17.790s
[INFO] Finished at: Wed Mar 12 15:14:32 EDT 2014
[INFO] Final Memory: 26M/229M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.kongchen:swagger-maven-plugin:2.0:generate (default) on project swagger-maven-example: java.net.ConnectException: Operation timed out -> [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

Any idea for these issue?

Sincerely,
Jeremy

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project wallet-core: Compilation failure: Compilation failure: [ERROR] /Users/mac1/Documents/alex/pilot/Alex-Wallet/wallet-core/src/main/java/com/alex/wallet/core/impl/PromotionServiceImpl.java:[117,61] diamond operator is not supported in -source 1.6

I have the following configuration: in my parent pom.file



org.apache.maven.plugins
maven-compiler-plugin
3.2

1.7
1.7




and in my sub-project:

            <groupId>com.github.kongchen</groupId>
            <artifactId>swagger-maven-plugin</artifactId>
            <version>3.1.1-SNAPSHOT</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
                <apiSources>

when I build, I get the error above...any ideas?

document.html - blank / 404

I have problem with generated html doc file. It is blank / 404 when I open it in browser. Can someone investigate it? :)

image

image

Swagger.json is not generating at all

Hi All,
Need help in generating swagger.json from swagger maven plugin.My POM file looks like:


4.0.0

<groupId>swagger-maven-example</groupId>
<artifactId>swagger-maven-example</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<pluginManagement>
    <plugins>
        <plugin>
            <groupId>com.github.kongchen</groupId>
            <artifactId>swagger-maven-plugin</artifactId>
             <version>3.0.1-SNAPSHOT</version> 
         <!--    <version>3.1.1-SNAPSHOT</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/</outputPath>
                        <swaggerDirectory>generated/swagger-ui</swaggerDirectory>
                    </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>
    </pluginManagement>
</build>
<dependencies>
   <dependency>
        <groupId>com.wordnik</groupId>
        <artifactId>swagger-core</artifactId>
        <scope>compile</scope>
        <version>1.5.1-M2</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>

Using :mvn compile to compile source.
It would be appreciated if anyone help it out.

Cannot load Swagger extension: com.github.kongchen.swagger.docgen.spring.SpringSwaggerExtension

I am using plugin version 3.1.8. When running the plugin, the AbstractDocumentSource is having an issue instantiating com.github.kongchen.swagger.docgen.spring.SpringSwaggerExtension class. Here is the full stack trace:
Caused by: com.github.kongchen.swagger.docgen.GenerateException: Cannot load Swagger extension: com.github.kongchen.swagger.docgen.spring.SpringSwaggerExtension
at com.github.kongchen.swagger.docgen.AbstractDocumentSource.resolveSwaggerExtensions(AbstractDocumentSource.java:438)
at com.github.kongchen.swagger.docgen.AbstractDocumentSource.loadSwaggerExtensions(AbstractDocumentSource.java:162)
at com.github.kongchen.swagger.docgen.AbstractDocumentSource.loadDocuments(AbstractDocumentSource.java:106)
at com.github.kongchen.swagger.docgen.mavenplugin.ApiDocumentMojo.execute(ApiDocumentMojo.java:122)
... 22 more
Caused by: java.lang.InstantiationException: com.github.kongchen.swagger.docgen.spring.SpringSwaggerExtension
at java.lang.Class.newInstance(Class.java:427)
at com.github.kongchen.swagger.docgen.AbstractDocumentSource.resolveSwaggerExtensions(AbstractDocumentSource.java:436)
... 25 more
Caused by: java.lang.NoSuchMethodException: com.github.kongchen.swagger.docgen.spring.SpringSwaggerExtension.()
at java.lang.Class.getConstructor0(Class.java:3082)
at java.lang.Class.newInstance(Class.java:412)
... 26 more

Cannot find 'supportSpringMvc' error while updating swagger version to 3.0.1 from 2.3.4

[ERROR] Failed to execute goal com.github.kongchen:swagger-maven-plugin:3.0.1:generate (default) on project abc-api-docs: Unable to parse configuration of mojo com.github.kongchen:swagger-maven-plugin:3.0.1:generate for parameter supportSpringMvc: Cannot find 'supportSpringMvc' in class com.github.kongchen.swagger.docgen.mavenplugin.ApiSource -> [Help 1]

Plugin configured as below.

swagger-api-doc false com.wordnik swagger-jaxrs_2.10 1.3.13 com.wordnik swagger-core_2.10 1.3.13 com.github.kongchen swagger-maven-plugin 3.0.1 false com.cbd.cdf 1.0 ${swagger.base.url} ${project.build.directory}/api-docs/${swagger.name} compile generate

Generate yaml in maven multi project

I have a simple maven project containing only one dependency install on my maven cache (dependency containing classes annotated with swagger annotations. When I launch mvn install it does not generate documentation associated to those annotations.
Here my pom.xml :

<swagger2markup.plugin.version>1.3.3</swagger2markup.plugin.version>
<swagger2markup.extension.version>1.3.1</swagger2markup.extension.version>
<swagger-maven-plugin-version>3.1.5</swagger-maven-plugin-version>
</properties>
   <dependencies>
       <dependency>
               <groupId>com.my.compagny</groupId>
               <artifactId>gen-documentation</artifactId>
               <version>1.0-SNAPSHOT</version>
       </dependency>
   </dependencies>
  <build>
      <defaultGoal>process-resources</defaultGoal>
       <plugins>
              <plugin>
                       <groupId>com.github.kongchen</groupId>
                       <artifactId>swagger-maven-plugin</artifactId>
                       <version>${swagger-maven-plugin-version}</version>
                       <configuration>
                               <apiSources>
                                       <apiSource>
                                               <springmvc>true</springmvc>
                                               <locations>
                                                       <location>com.mypackage.to.annotated.classes.*</location>
                                                       </locations>
                                               <info>
                                                      <title>Swagger Sample App</title>
                                                      <description>This is a sample server Petstore server.</description>
                                                       <version>1.0</version>
                                              </info>
                                               <outputFormats>yaml</outputFormats>
                                               <swaggerDirectory>./src/docs</swaggerDirectory>
                                       </apiSource>
                               </apiSources>
                       </configuration>
                       <executions>
                               <execution>
                                       <phase>install</phase>
                                       <goals>
                                               <goal>generate</goal>
                                       </goals>
                               </execution>
                       </executions>
               </plugin>```
.....
Why does it not generate my yaml file ?

Apmoust empty swagger.json with swagger-maven-plugin-3.1.1-SNAPSHOT

Updated the project to use swagger-maven-plugin-3.1.1-SNAPSHOT, since 3.0.1-SNAPSHOT cannot be found and all I got under swager.json is :
{
"swagger" : "2.0",
"info" : {
"description" : "This is a sample for swagger-maven-plugin",
"version" : "v1",
"title" : "Swagger Maven Plugin Sample",
"termsOfService" : "http://www.github.com/kongchen/swagger-maven-plugin",
"contact" : {
"name" : "Kong Chen",
"url" : "http://kongch.com",
"email" : "[email protected]"
},
"license" : {
"name" : "Apache 2.0",
"url" : "http://www.apache.org/licenses/LICENSE-2.0.html"
}
},
"host" : "petstore.swagger.wordnik.com",
"basePath" : "/api",
"schemes" : [ "http", "https" ]
}

Is @JsonView supported and honored in generated swagger?

Hi,

Trying to exclude some fields in a model, which is achieved by @JsonView through interfaces, which works well on the responses we want to exclude.
However, we found out that the output swagger still includes them.

So just wandering if @JsonView is supported & honored in the generated swagger spec as it seems to ignore these, showing everything in the model.

One workaround that we have right now though is the combination usage of modelSubstitue and apiModelPropertyAccessExclusion which doesn't really seems nice, having to create a custom class just for generating a swaggerspec, and will need to maintain the class since it is copied from a generated class.

error NullPointerException on compile with version 3.1.8

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.