[英]How can I get the Javadoc class descriptions at compile time?
I'm trying to build up some documentation for my Wicket Web Application. 我正在尝试为我的Wicket Web应用程序构建一些文档。 I have created a page to grab all of my mounted pages and display them in /sitemap.xml.
我创建了一个页面来抓取所有已安装的页面并将它们显示在/sitemap.xml中。 In the vein of documentation I've added a new tag to the file
<siteMap:Description>
now I want to fill that description with the javadoc entry that describes the class file. 在文档方面,我已经向文件
<siteMap:Description>
添加了一个新标签,现在我想用描述类文件的javadoc条目来填充该描述。
I know there is know direct way to access them at runtime. 我知道有一种直接的方法可以在运行时访问它们。 So Instead I'm hoping to copy them at compile time into a List where they will then be accessible from runtime.
因此,我希望将它们在编译时复制到List中,然后可以从运行时对其进行访问。 How would I do that?
我该怎么做?
I'm using Maven for my build. 我正在使用Maven进行构建。
EDIT 编辑
I should probably Also mention that I do have an AntTask Already defined as part of my build process to save the compile Dates/times to a property file. 我可能还应该提到,在构建过程中,我确实已经定义了AntTask,以将编译日期/时间保存到属性文件中。
It seems to me an Task to scan my Class and then put the information into a file is probably the way to go. 在我看来,执行任务是扫描我的班级,然后将信息放入文件中。 Problem is I'm not sure how to proceed.
问题是我不确定如何继续。
My Ant-Task is defined like in my pom.xml so: 我的Ant任务的定义就像在pom.xml中一样,因此:
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<dependencies>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-nodeps</artifactId>
<version>1.6.5</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>set-build-time</id>
<phase>process-sources</phase>
<configuration>
<tasks>
<tstamp>
<format property="build.timestamp" pattern="yyyy/MM/dd HH:mm:ss"/>
<format property="build.time" pattern="HH:mm:ss" />
<format property="build.date" pattern="MM/dd/yyyy" />
<format property="build.year" pattern="yyyy"/>
</tstamp>
<replaceregexp byline="true">
<regexp pattern="copyYear\=.*" />
<!--suppress MavenModelInspection -->
<substitution expression="copyYear=${build.year}" />
<fileset dir="src/main/java/" includes="**/*.properties" />
</replaceregexp>
<replaceregexp byline="true">
<regexp pattern="buildTime\=.*" />
<!--suppress MavenModelInspection -->
<substitution expression="buildTime=${build.date} ${build.time}" />
<fileset dir="src/main/java/" includes="**/*.properties" />
</replaceregexp>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
After doing more research I determined I was barking up the wrong tree. 经过更多的研究后,我确定我正在树错树皮。
I since I was trying to get Javadoc comments A Doclet was the better answer. 自从尝试获取Javadoc注释以来,我就选择了Doclet是更好的答案。 So I implemented a custom doclet and wired it up to run automatically as described in the follow up question and answer below.
因此,我实现了一个自定义doclet,并将其连接起来以自动运行,如下面的后续问题和解答所述。
How can I compile and run my Custom Doclet class in my project? 如何在项目中编译和运行我的Custom Doclet类?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.