Comments (8)
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.
from springfox-javadoc.
+1
from springfox-javadoc.
Thanks for the hint @AnnaNesterkina. Ill try to update the readme with instructions.
from springfox-javadoc.
@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.
from springfox-javadoc.
@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
from springfox-javadoc.
@AnnaNesterkina @rahuljain1804 would be great if either of you have a fix in mind for this.
from springfox-javadoc.
@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.
from springfox-javadoc.
@rahuljain1804 thank for helping out, will definitely reach out if I have questions
from springfox-javadoc.
Related Issues (13)
- Upgrade to CircleCi 2.0
- New Feature > Update Doclet in order to make it compatible with Java9 and make it compatible with Gradle build
- New Feature > Support documentation of Model (description + params) via Javadoc
- New Feature > Support documentation of API via Javadoc
- Can official provide a simple demo HOT 13
- Is that project dead?
- Date of release in repos? HOT 4
- Changes to make it compatible with maven central
- Support Kotlin-based controllers using Dokka
- Support "summary" field for ApiOperations HOT 1
- Corrupted Properties file generated for multivalued Request Mapping HOT 1
- How to use/run it exactly? HOT 21
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from springfox-javadoc.