我正在使用Gradle项目,该项目后来由Jenkins管道构建和测试。
Groovy类:
class ConfigurationPluginInitBase implements Plugin<Project> {
private static final Logger logger = LoggerFactory.getLogger(ConfigurationPluginInitBase.class)
.
.
.
protected void configureDependenciesResolution(Project project) {
.
.
.
File file = new File(project.getRootDir(), 'buildInfo.json')
def rewriteDependency = project.hasProperty('rewriteDependency') ? project.property('rewriteDependency') : null
logger.info('Does the buildInfo.json exist??? {}' , file.exists())
logger.info('The list of the dependencies should be re-written: {}' , rewriteDependency)
.
.
.
if (rewriteDependency) {
def listToUpdate = rewriteDependency.split(',')
logger.info('List is : {}' , listToUpdate)
.
.
.
}
}
}
上述方法是通过Jenkins管道(部分控制台输出)触发的:
Configuring Dependencies Resolution
Does the buildInfo.json exist??? true
The list of the dependencies should be re-written:
List is :
我什至尝试将'rewriteDependency'和'listToUpdate'强制转换为对象,但这无济于事。
注意:如果我使用println,则输出类似于:
Configuring Dependencies Resolution
Does the buildInfo.json exist??? true
The list of the dependencies should be re-written:
DAP_Framework:DAP_Framework_CLI:1.2.2-integration.332a45d
List is : [DAP_Framework:DAP_Framework_CLI:1.2.2-integration.332a45d]