Skip to content
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

Feature/#13 support for jdk9 - controller doc - gradle example - refactoring #15

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions .build/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.1//EN"
"http://www.puppycrawl.com/dtds/configuration_1_1.dtd">
"http://www.puppycrawl.com/dtds/configuration_1_1.dtd">

<!-- A set of Checkstyle rules that should be applied to non-legacy modules that should adhere to relatively strict
code style rules. -->
Expand All @@ -25,19 +25,13 @@
value="Calls to Throwable.printStackTrace() are not allowed. Log the exception instead."/>
</module>

<!--
Along with the FileContentsHolder module, allows for adding comments to source code to suppress checks.
http://checkstyle.sourceforge.net/config.html#Filters
-->
<module name="SuppressionCommentFilter"/>

<module name="TreeWalker">

<!--
Along with the SuppressionCommentFilter module, allows for adding comments to source code to suppress checks.
http://checkstyle.sourceforge.net/config.html#Filters
Along with the FileContentsHolder module, allows for adding comments to source code to suppress checks.
http://checkstyle.sourceforge.net/config.html#Filters
-->
<module name="FileContentsHolder"/>
<module name="SuppressionCommentFilter"/>

<!-- Import checks - http://checkstyle.sourceforge.net/config_imports.html -->
<module name="UnusedImports"/>
Expand Down Expand Up @@ -86,7 +80,7 @@
</module>

<module name="RegexpHeader">
<property name="headerFile" value=".build/apache-copyright.header" />
<property name="fileExtensions" value="java, groovy" />
<property name="headerFile" value=".build/apache-copyright.header"/>
<property name="fileExtensions" value="java, groovy"/>
</module>
</module>
13 changes: 6 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ jobs:
build:
working_directory: ~/code
docker:
- image: circleci/openjdk:8-jdk-node-browsers
- image: circleci/openjdk:9-jdk-node-browsers
environment:
JVM_OPTIONS: -Xmx1024M -XX:MaxPermSize=512M -XX:ReservedCodeCacheSize=512M
GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-Xmx3840m -XX:+HeapDumpOnOutOfMemoryError"'
Expand Down Expand Up @@ -41,20 +41,19 @@ jobs:
mkdir -p ~/junit/
mkdir -p ~/reports/
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/junit/ \;
cp -R build/reports/tests ~/reports
cp -R springfox-javadoc/build/reports ~/reports
when: always
- store_test_results:
path: ~/junit
- store_test_results:
path: ~/reports
- store_artifacts:
path: ~/junit
path: ~/junit
- store_artifacts:
path: ~/reports
path: ~/reports
- deploy:
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
./gradlew artifactoryPublish -x check
cd springfox-javadoc
../gradlew artifactoryPublish -x check
fi
notify:
webhooks:
Expand Down
4 changes: 0 additions & 4 deletions .gitattributes

This file was deleted.

Binary file removed .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
1 change: 0 additions & 1 deletion .mvn/wrapper/maven-wrapper.properties

This file was deleted.

32 changes: 28 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,32 @@
[![CircleCI](https://circleci.com/gh/springfox/springfox-javadoc.svg?style=svg)](https://circleci.com/gh/springfox/springfox-javadoc) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/32f99b3650794b5eb1f7c155a57d5100)](https://app.codacy.com/app/dilip-krishnan-github/springfox-javadoc?utm_source=github.com&utm_medium=referral&utm_content=springfox/springfox-javadoc&utm_campaign=badger)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fspringfox%2Fspringfox-javadoc.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fspringfox%2Fspringfox-javadoc?ref=badge_shield)

Ability to use Javadoc for documentation for generating OpenAPI specifications
# Overview
Ability to use Javadoc for documentation for generating OpenAPI specifications.

To use this, make sure that `JavadocPluginConfiguration` is found by your spring context and add the execution of the javadoc doclet to your build process.
Using Spring Boot the necessary plugins are automatically bootstrapped, so no configuration is needed.

Maven example:
Otherwise you have to manually instantiate them (see the list in JavadocPluginConfiguration class).

# Compatibility

Only Java9+ is supported.

Spring MVC is supported but not SpringWebFlux.

# How does it work?

The Javadoc is extracted using a custom Doclet which is passed to the javadoc tool.
The Javadoc is stored in a file which must be on the classpath of the application.

At runtime, this file is read by a bunch of Springfox plugins to customize the Documentation model.

# Howe to use?

## Gradle Spring Boot example
[See the example project](./springfox-javadoc-gradle-example).

## Maven example
```xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -38,6 +59,9 @@ Maven example:
</plugin>
```

## TODO

- Prefix generated properties with common prefix (like io.springfox.javadoc)

## License
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fspringfox%2Fspringfox-javadoc.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fspringfox%2Fspringfox-javadoc?ref=badge_large)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fspringfox%2Fspringfox-javadoc.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fspringfox%2Fspringfox-javadoc?ref=badge_large)
66 changes: 26 additions & 40 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,32 @@ plugins {
id "com.jfrog.bintray" version "1.8.4"
}

apply plugin: 'idea'
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'osgi'
apply plugin: 'jacoco'
apply plugin: 'maven-publish'
apply from: "publishing.gradle"

group = 'io.springfox'
description = "springfox-javadoc"

sourceCompatibility = 1.6
targetCompatibility = 1.6

tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.deprecation = true
options.compilerArgs += ["-Xlint:unchecked", "-parameters"]
}

repositories {
jcenter()
mavenCentral()
}

dependencies {
compile 'io.springfox:springfox-swagger2:2.9.2'
compile 'org.springframework:spring-webmvc:4.3.18.RELEASE'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:2.21.0'
compile files("${System.getProperty('java.home')}/../lib/tools.jar")
}

jacoco {
toolVersion = "0.8.1"
}
allprojects {
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'idea'
apply plugin: 'java-library'
apply plugin: 'maven'

group = 'io.springfox'

sourceCompatibility = 1.9
targetCompatibility = 1.9

tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.deprecation = true
options.compilerArgs += ["-Xlint:unchecked", "-parameters"]
}

jacocoTestReport {
reports {
xml.enabled true
html.enabled true
repositories {
jcenter()
mavenCentral()
maven {
name = 'bintray-springfox-snapshot'
url = "http://oss.jfrog.org/oss-snapshot-local/"
}
}

}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=0.10.0-SNAPSHOT
version=1.0.0-SNAPSHOT
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.3.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 2 additions & 0 deletions jitpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
jdk:
- openjdk9
Loading