mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-12 10:55:20 +02:00
use classloader
This commit is contained in:
parent
a449adf4bc
commit
a896487032
@ -20,12 +20,15 @@ static boolean hasTestFailures(build){
|
||||
}
|
||||
|
||||
static boolean addWarningsNGParser(String id, String name, String regex, String script, String example = ''){
|
||||
if(io.jenkins.plugins.analysis.warnings.groovy.ParserConfiguration.getInstance().contains(id)){
|
||||
def classLoader = this.getClass().getClassLoader()
|
||||
config = classLoader.loadClass('io.jenkins.plugins.analysis.warnings.groovy.ParserConfiguration', true, false)?.getInstance()
|
||||
|
||||
if(config.contains(id)){
|
||||
return false
|
||||
}else{
|
||||
io.jenkins.plugins.analysis.warnings.groovy.ParserConfiguration.getInstance().setParsers(
|
||||
io.jenkins.plugins.analysis.warnings.groovy.ParserConfiguration.getInstance().getParsers().plus(
|
||||
new io.jenkins.plugins.analysis.warnings.groovy.GroovyParser(id, name, regex, script, example)
|
||||
config.setParsers(
|
||||
config.getParsers().plus(
|
||||
classLoader.loadClass('io.jenkins.plugins.analysis.warnings.groovy.GroovyParser', true, false)?.newInstance(id, name, regex, script, example)
|
||||
)
|
||||
)
|
||||
return true
|
||||
|
Loading…
Reference in New Issue
Block a user