简体   繁体   English

JavaDoc提供完全限定的类名...如何缩写?

[英]JavaDoc giving fully-qualified class name… how to abbreviate?

Problem 问题

I'm running mvn javadoc:javadoc to generate JavaDoc, and I am pleased with the results, except for one thing: it gives the fully qualified class names for any class coming from a third-party library or our own codebase. 我正在运行mvn javadoc:javadoc来生成JavaDoc,我很满意结果,除了一件事:它为来自第三方库或我们自己的代码库的任何类提供了完全限定的类名。 For example, 例如,

It gives a return type of com.project.beans.BeanA , com.project.beans.BeanB for methods that return one of these classes. 它为返回其中一个类的方法提供了com.project.beans.BeanAcom.project.beans.BeanB的返回类型。

It gives a param type of org.codehaus.jettison.json.JSONObject for a method that takes a JSON object. 它为获取JSON对象的方法提供了一个param类型的org.codehaus.jettison.json.JSONObject (Whereas it gives a param type of Integer for a method that takes a java.lang.Integer.) (虽然它为一个带有java.lang.Integer的方法提供了一个param类型的Integer。)

Question

Is there any way to generate the shorthand names for these classes, for readability purposes? 出于可读性目的,有没有办法为这些类生成速记名称? ie BeanA, BeanB, JSONObject. 即BeanA,BeanB,JSONObject。

And is there a way to do this without any XML configuration? 有没有办法在没有任何XML配置的情况下执行此操作?

Thanks in advance :-) 提前致谢 :-)

I believe that what you want is the -noqualifier javadoc option which can be set directly from the maven javadoc:javadoc command. 我相信你想要的是-noqualifier javadoc选项 ,它可以直接从maven javadoc:javadoc命令设置。

Usually to pass the parameter to a maven plugin you just do like for other Java programs using -D , in this case it would be mvn -Dnoqualifier=all javadoc:javadoc but as far as I can tell the noqualifier does not seems to ben set as an expression in the plugin source so I don't really know if you can pass it via the command line. 通常将参数传递给maven插件你就像使用-D其他Java程序一样,在这种情况下它将是mvn -Dnoqualifier=all javadoc:javadoc但是据我所知, noqualifier似乎没有设置作为插件源中的表达式,所以我真的不知道你是否可以通过命令行传递它。

If it does not work, you can either modify your pom.xml and add the <noqualifier>all</noqualifier> to the config of the javadoc plugin. 如果它不起作用,您可以修改pom.xml并将<noqualifier>all</noqualifier>javadoc插件的配置中。 Or you could create a property in your pom that will be given as a value for the <noqualifier> tag, but this time the property can be overridden using the command line. 或者您可以在pom中创建一个属性,该属性将作为<noqualifier>标记的值给出,但这次可以使用命令行覆盖该属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM