-
Notifications
You must be signed in to change notification settings - Fork 15
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
Using with gradle #8
Comments
+1 |
Hi guys, There's an issue with gradle. The default javadoc task always sets the -d option (output directory for the standard javadoc doclet). However, the custom springfox-javadoc doclet does not recognize that option and instead uses the -classdir option to set the output directory. So your task will always pass the -d option to the custom doclet, but the doclet won't work because of the unrecognized option. A managed to write a task whith a workaround that works whith gradle 3.3, but it results in error in gradle 4.8. task javadoc2swagger(type: Javadoc , dependsOn: compileJava ) {
source = sourceSets.main.allJava
classpath = sourceSets.main.compileClasspath
options.doclet = "springfox.javadoc.doclet.SwaggerPropertiesDoclet"
options.addStringOption("classdir", "${sourceSets.main.output.resourcesDir}")
options.addStringOption("exceptionRef", "true")
options.encoding("UTF8")
//workaround not to pass default options
title = null
options.addStringOption("d", null)
doFirst {
options.docletpath = configurations.springfoxJavadoc.files.asList()
}
}
jar.dependsOn(javadoc2swagger) For newer versions of gradle I guess you'll need to use an ant task to get the doclet to work. To get the doclet to work properly with newer versions of gradle, it would be better to use the -d option instead of -classdir or at least to recognize the -d option and simply ignore it. |
Thanks for the hint @AnnaNesterkina. Ill try to update the readme with instructions. |
@dilipkrish as I mentioned, this code doesn't work with newer versions of gradle. What do you think about making it possible to pass the output dir via -d option (it's set via destinationDir in gradle and destDir in maven). Spring Auto Rest Docs does so, you can view their documentation ( https://htmlpreview.github.io/?https://github.com/ScaCap/spring-auto-restdocs/blob/v2.0.1/docs/index.html ). We can leave the classDir option for backwards compatibility. I am willing to submit a pull request for this. |
@AnnaNesterkina, @dilipkrish - I also made changes for the same. I think we should just created a PR and release a new version for the same. If you can give me permissions to create a PR, I can submit that |
@AnnaNesterkina @rahuljain1804 would be great if either of you have a fix in mind for this. |
@dilipkrish - Missed the notification. Saw this just now. I guess there is already one PR open for the issue which should fix it (however, it is not backward compatible). For now, I was using it by adding additional parameters for the newer versions of gradle. Let me know if that works. I can submit a PR for the same. |
@rahuljain1804 thank for helping out, will definitely reach out if I have questions |
Hello guys,
Can I use this plugin with Gradle? If yes then how?
Thanks!
The text was updated successfully, but these errors were encountered: