Git Product home page Git Product logo

Comments (8)

anesterkina avatar anesterkina commented on August 15, 2024 3

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.

rahuljain1804 avatar rahuljain1804 commented on August 15, 2024

+1

from springfox-javadoc.

dilipkrish avatar dilipkrish commented on August 15, 2024

Thanks for the hint @AnnaNesterkina. Ill try to update the readme with instructions.

from springfox-javadoc.

anesterkina avatar anesterkina commented on August 15, 2024

@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.

rahuljain1804 avatar rahuljain1804 commented on August 15, 2024

@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.

dilipkrish avatar dilipkrish commented on August 15, 2024

@AnnaNesterkina @rahuljain1804 would be great if either of you have a fix in mind for this.

from springfox-javadoc.

rahuljain1804 avatar rahuljain1804 commented on August 15, 2024

@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.

dilipkrish avatar dilipkrish commented on August 15, 2024

@rahuljain1804 thank for helping out, will definitely reach out if I have questions

from springfox-javadoc.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.