2016-07-05 1 views
1

주어진 경로에서 모든 솔루션 파일 (* .sln)을 가져 와서 쉼표 구분 기호를 사용하여 문자열 (각 솔루션 파일 경로)을 분할하여 개별적으로 인쇄하려고했습니다. 사용중인 스크립트 언어 프로그래밍은 Jenkins Groovy입니다. Jenkins 작업을 빌드 할 때 아래에 지정된 오류가 발생합니다. 어떤 사람이 이것을 들여다보고 올바른 방법으로 진행하도록 안내해주십시오.Jenkins Groovy 스크립트에서 쉼표 구분 기호를 사용하여 문자열을 분할하는 방법은 무엇입니까?

def finder = new FileNameFinder() 
def files = finder.getFileNames 'D:\jobs', '**/*.sln' 
def resultList = files.tokenize(",") 

for(i=0; i<resultList.size();i++) 
{ 
println resultList[i] 
} 

오류 정보 : 사전에

hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: java.util.ArrayList.tokenize() is applicable for argument types: (java.lang.String) values: [,] 
Possible solutions: toUnique(), toUnique(), toUnique(java.util.Comparator), takeWhile(groovy.lang.Closure), toUnique(groovy.lang.Closure), toUnique(java.util.Comparator) 

감사합니다!

답변

1

내 자신이 내 위의 문제에 대한 답변을 찾았습니다. 아래에서 수정 된 작업 코드를 찾으십시오.

def finder = new FileNameFinder() 
def files = finder.getFileNames 'D:\jobs', '**/*.sln' 
assert files instanceof List 
println files.size()+" solution files found in the given path. Below are the found solution files details. \n" 
for(i=0;i<files.size();i++) 
{ 
println files[i]; 
} 

감사

관련 문제