Does your java file import
      import com.wordnik.swagger.annotations.Api;
                  or 
      import io.swagger.annotations.Api;

It will work with import com.wordnik.swagger.annotations.Api;.

Can you share me the template file you are using. For me, it is generating 
the json file but in different format.

On Monday, 19 June 2017 09:37:42 UTC+5:30, Thammaiah Manadamada wrote:
>
> Hi All,
>
> I have used swagger-ant-task 0.0.2 version in my project i have added 
> task to my ant file as shown below
>
> <property name="swaggerAntLib" 
> value="C:/Users/tmb/Documents/NetBeansProjects/LIBRARY" /> <path 
> id="swagger.classpath"> <fileset dir="${java.home}"> <include 
> name="lib/tools.jar"/> </fileset> <fileset dir="${swaggerAntLib}"> <include 
> name="*/**"/> </fileset> <fileset dir="build/web/WEB-INF/classes"> <include 
> name="*/**"/> </fileset> </path> <target name="swaggertask.init" 
> description="Define the swagger task."> <taskdef name="swagger1" 
> classname="com.github.cstroe.swagger.docgen.SwaggerTask" 
> classpathref="swagger.classpath"/> </target> <target 
> name="swaggertask.first" description="A typical swagger task definition." 
> depends="swaggertask.init"> <swagger1> <apiSources> <apiSource> 
> <locations>com.thammaiah.swager.resource</locations> 
> <schemes>http,https</schemes> <host>www.example.com:8080</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> 
> <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" --> 
> <swaggerDirectory>${basedir}</swaggerDirectory> 
> <attachSwaggerArtifact>true</attachSwaggerArtifact> </apiSource> 
> </apiSources> </swagger1> </target> <target name="swaggertask" 
> description="All tests." depends="swaggertask.first"/>
>
> I have created a netbeans web project to do the same.My resource classes 
> are under src/java/com/thammaiah/swagger/resource. However when i run the 
> target to generate swagger it is generating a swagger which do not have api 
> details.
> That is it is not able to find the resource with @Api annotation.
>
> JSON Generated
>
> {
>   "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";,
>     "license" : {
>       "name" : "Apache 2.0",
>       "url" : "http://www.apache.org/licenses/LICENSE-2.0.html";
>     }
>   },
>   "host" : "www.example.com:8080",
>   "basePath" : "/api",
>   "schemes" : [ "http", "https" ]
> } 
>
> NOTE: I have tried maven plugin it creates a proper expected JSON. But 
> could not achieve using ant.
>
> Please let me know if i am missing something. 
>
> Regards,
> Thammaiah
>

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to swagger-swaggersocket+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to