[ https://issues.apache.org/jira/browse/FLINK-5781?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15959777#comment-15959777 ]
ASF GitHub Bot commented on FLINK-5781: --------------------------------------- Github user zentol commented on the issue: https://github.com/apache/flink/pull/3495 Alright here's what i came up with. We define a single antrun task which does the following: Since all *Options classes reside in the same directory we just take a look in there and filter out the Options classes. We then load the class via reflection, generate the html and manually write out the file. The antrun plugin in flink-core is configured like this: ``` <plugin> <artifactId>maven-antrun-plugin</artifactId> <version>1.7</version> <executions> <execution> <id>high-availability</id> <phase>package</phase> <goals> <goal>run</goal> </goals> <configuration> <target> <java classname="org.apache.flink.configuration.ConfigGroup" fork="true"> <classpath refid="maven.compile.classpath" /> <arg value="${rootDir}/${generated.docs.dir}/" /> </java> </target> </configuration> </execution> </executions> </plugin> ``` While the ConfigGroup has gotten a new main method: ``ยด public static void main(String[] args) throws Exception { String basePath = args[0]; File path = new File("../src/main/java/org/apache/flink/configuration/"); String[] classes = path.list(); Pattern p2 = Pattern.compile("([A-Z][a-z]*)"); Pattern p = Pattern.compile("([a-zA-Z]*Options).java"); for (String clazz : classes) { Matcher m = p.matcher(clazz); if (m.matches()) { String className = m.group(1); if (!className.equals("ConfigOptions")) { Matcher m2 = p2.matcher(clazz); List<String> parts = new ArrayList<>(); while (m2.find()) { parts.add(m2.group(1)); } StringBuilder sb = new StringBuilder(); for (int x = 0; x < parts.size() - 1; x++) { sb.append(parts.get(x).toLowerCase()); sb.append("_"); } sb.append("configuration.html"); String generatedDocFilePath = basePath + sb; String fullClassPath = "org.apache.flink.configuration." + className; String doc = create(Class.forName(fullClassPath)).toHTMLTable(false); File f = new File(generatedDocFilePath); f.getParentFile().mkdirs(); f.createNewFile(); try (FileWriter fw = new FileWriter(f)) { fw.write(doc); fw.flush(); } } } } } ``` Haven't cleaned the code up yet, since it's 11pm after all, but it works. Maybe you can refine it a bit. The result is that the docs will be generated automatically for every new *Options class that is placed under org.apache.flink.configuration in flink-core, which is a must-have imo. > Generation HTML from ConfigOption > --------------------------------- > > Key: FLINK-5781 > URL: https://issues.apache.org/jira/browse/FLINK-5781 > Project: Flink > Issue Type: Sub-task > Components: Documentation > Reporter: Ufuk Celebi > Assignee: Dawid Wysakowicz > > Use the ConfigOption instances to generate a HTML page that we can use to > include in the docs configuration page. -- This message was sent by Atlassian JIRA (v6.3.15#6346)