private void generateSwaggerFiles(ResourceParser resourceParser)
    {
        File dir = new File(project.getBuild().getOutputDirectory() +apiListing.getOutputWebDir());
        if( !dir.exists() )
        {
            dir.mkdir();
        }

        if( dir.isDirectory() ){
            try{
                //write the ResourceListing root file
                File resourceFile = outputDirectoryAndFile;//new File(dir.getPath() +"/index.json");
                if( !resourceFile.getParentFile().exists() )
                {
                    resourceFile.getParentFile().mkdir();
                }

                FileWriter writer = new FileWriter(resourceFile);
                writer.write(apiListing.toJson());
                writer.close();

                //write each of the individual resource API files
                int indx = 1;
                for (ApiDeclaration api : resourceParser.getApis()) {
                    File apiFile = new File(resourceFile.getParentFile() +"/"  +api.getFileName());
                    FileWriter apiWriter = new FileWriter(apiFile);
                    apiWriter.write(api.toJson());
                    apiWriter.close();
                }

            }catch(Exception ex){
                ex.printStackTrace();
            }
        }
    }