如何自动将所有 javadoc package.html 文件转换为 package-info.java 文件?
我们在项目中使用了很多旧的 package.html
文件,我们希望将它们转换为 package-info.java
文件。手动执行此操作不是一个选项(文件太多)。有没有一个好的方法可以实现自动化?
我们想要转换它们有几个原因:
来自 javadoc 规范:此文件是 JDK 5.0 中的新文件,并且优先于 package.html。
不要在同一代码库中混合两种类型的文件
为了避免 Intellij/Eclipse 构建,请将这些 *.html 文件放在我们的类目录中(也可能放在发布的二进制 jar 中),这样它们的行为就像我们其他普通的 html 资源一样。
We use a lot of legacy package.html
files in our project and we want to convert them to package-info.java
files. Doing that manually isn't an option (way too many files). Is there a good way to automate that?
We want to convert them for a couple of reasons:
From the javadoc specs: This file is new in JDK 5.0, and is preferred over package.html.
To not mix both types of files in the same codebase
To avoid that Intellij/Eclipse builds put those *.html files in our classes dirs (and possibly in a release binary jars) so they behave like our other normal html resources.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您没有运行 Windows,则可能需要更改目录分隔符。另外,转换有点麻烦,但应该可以。出于好奇,您有多少个软件包无法使用手册?
You may need to change the directory separator if you're not running windows. Also, the conversion is a bit of a hack, but it should work. Out of curiosity, how many packages do you have that manual isn't an option?
IntelliJ 人员打算对所有文件执行此操作。该问题已得到解决,可能会在下一个 IntelliJ 版本中发布。
The IntelliJ guys have made an intention to do this for all files. It's been resolved and will probably be released in the next IntelliJ release.
要在 IDEA 中以批处理模式执行此操作:
package.html
文件sed -i "/Put @see and @since/d" `find . -name "package-info.java"`
)To do this in batch mode in IDEA:
package.html
filesed -i "/Put @see and @since/d" `find . -name "package-info.java"`
)