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

Swagger.json is not generating at all #16

Open
HarshSama opened this issue Feb 20, 2017 · 2 comments
Open

Swagger.json is not generating at all #16

HarshSama opened this issue Feb 20, 2017 · 2 comments

Comments

@HarshSama
Copy link

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.

@trungdoviet
Copy link

I got the same issue, just download this example, change version of swagger plugin to newest one (3.1.6-SNAPSHOT) but after run mvn compile, the json is just:
{ "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" ] }

Does anyone help?

@trungdoviet
Copy link

Hi @HarshSama
You may need to try this #9

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

2 participants