Структура каталогов соответствует стандартной разделяемой библиотеке Jenkins. Я использую задачу groovydoc через IntelliJ.
src
- com
- jenkins
- //various packages and groovy classes
vars
- package-info.groovy
- snapHandler.groovy
//many more groovy scripts
Пакет-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 ошибочно - описание на верхнем уровне показано под первым методом, описание второго метода вообще не показано.
Я сослался на существующие потоки, такие как это и это, которые дали мне создается впечатление, что сценарии groovy, как ожидается, столкнутся с проблемами (поскольку они не являются полностью квалифицированными классами, а файлами сценариев)