目录结构是标准Jenkins shared library的目录结构。我正在通过IntelliJ使用groovydoc任务。
src
- com
- jenkins
- //various packages and groovy classes
vars
- package-info.groovy
- snapHandler.groovy
//many more groovy scripts
package-info.groovy具有以下内容
/**
* The vars directory hosts script files that are exposed as a variable in Pipelines.
* The name of the file is the name of the variable in the Pipeline.
* So if you had a file called vars/log.groovy with a function like def info(message)… in it, you can access this function like log.info "hello world" in the Pipeline.
* You can put as many functions as you like inside this file.
* <p>
* As a convention, whenever the term 'global variable/vars' is used, it refers to the file(s) in this directory.
* <p>
* For better understanding,
* @see <a href="https://www.jenkins.io/doc/book/pipeline/shared-libraries/#directory-structure">
* Understanding Jenkins Shared Libraries</a>
*
*/
snapHandler如下:
/**
* An interface to all the SNAP-related utilities. During it's inception, the idea was to encapsulate
* the entire lifecycle of SNAP changes, irrespective of their types(Normal, Standard, Emergency, etc.) so
* that the calling code(a pipeline or a library function) can pass the desired and required params but
* need not bother about the internals of interacting with the SNAP system.
* <p>Note that this global variable can have multiple methods.
*/
import com.jenkins.utilities.snap.ChangeProcessDelegate
import com.jenkins.utilities.snap.constants.Constants
import com.jenkins.utilities.snap.constants.RestAPIRequestResponseKeys
/**
*
* @param parameters
* @return
*/
Map recordStandardChange(Map parameters = [:]) {
String snapServerURL = parameters.get(RestAPIRequestResponseKeys.SNAP_SERVER_URL,
Constants.DEFAULT_SNAP_SERVER_URL)
ChangeProcessDelegate changeProcessDelegate = new ChangeProcessDelegate(this, snapServerURL)
//Complete the lifecycle of the Standard change created above.
changeProcessDelegate.processStandardChange(parameters)
}
/**
*
* @param parameters
* @return
*/
Map recordNormalChange(Map parameters = [:]) {
String snapServerURL = parameters.get(RestAPIRequestResponseKeys.SNAP_SERVER_URL,
Constants.DEFAULT_SNAP_SERVER_URL)
ChangeProcessDelegate changeProcessDelegate = new ChangeProcessDelegate(this, snapServerURL)
//Complete the lifecycle of the Normal change created above.
changeProcessDelegate.processNormalChange(parameters)
}
预期:正确生成了源类及其方法的API。
预期:默认的软件包文档。对应于vars / package-info.groovy
意外:文档。因为snapHandler是错误的-顶层的描述显示在第一种方法下,根本没有显示第二种方法的描述。
我提到了this和this之类的现有线程,这些线程给我的印象是,普通脚本可能会遇到问题(因为它们不是完全合格的类,而是脚本文件)