1
안녕하세요 저는 젠킨스/개미/그루비 세계에서 새로운 것이고 Google은 제 문제를 해결할 수 없었습니다.개미 스크립트 javac 명령이 groovy 스크립트로 변환 됨 AntBuilder.javac
내 임무는 jenkins로 빌드 프로세스에서 앤트 스크립트를 제거하고 jenkins 작업 (Execute system Groovy 스크립트)에 포함시키는 것입니다.
내 스크립트의 굵게 표시된 부분이 실패의 원인이지만이 문제를 해결할 방법을 모릅니다.
누군가가 저를 도와 줄 수 있기를 바랍니다.
입니다 내 "시스템 그루비 스크립트를 실행"
antbuild = new AntBuilder()
projectHome = '...Homedirectory'
projectDomainModel = projectHome + '/CSSDomainModel'
projectPresentationBase = projectHome + '/CSSPresentationBase'
projectServices = projectHome + '/CSSServices'
projectResource = projectHome + '/src/main/resources'
Sources = projectHome + '/Presentation/JavaSource'
projectLibraries = 'lib/bin'
projectWebContent = projectHome + '/Presentation/WebContent'
projectWebInf = projectWebContent + '/WEB-INF'
deployHome = projectHome + '/target/servicekundenportal'
deployBuild = deployHome + '/build/classes'
deployWebInf = deployHome + '/WEB-INF'
foreignSources = 'src'
deployWARFile = deployHome + '/serviceportal.war'
j2eeLibraries = 'D:/Programme_x64/tomcat/8.0.21/Instanz_02/lib'
compileTarget = '1.8'
<b>compilerSourceFiles = antbuild.path{
pathelement(path:Sources)
pathelement(path:projectDomainModel + '/' + foreignSources)
pathelement(path:projectPresentationBase + '/' + foreignSources)
pathelement(path:projectServices + '/' + foreignSources)
}
compilerLibraryFiles = antbuild.path{
fileset(dir:projectDomainModel + '/' + projectLibraries) {include name:'**/*.jar'}
fileset(dir:projectPresentationBase + '/' + projectLibraries) {include name:'**/*.jar'}
fileset(dir:projectServices + '/' + projectLibraries) {include name:'**/*.jar'}
fileset(dir:j2eeLibraries) {include name:'**/*.jar'}
}</b>
antbuild.delete(dir:deployHome)
antbuild.delete(file:deployWARFile)
antbuild.mkdir(dir:deployBuild)
build() {
antbuild.javac(
destdir:deployBuild,
target:compileTarget,
debug:true,
fork:true,
executable:'D:/Programme_x64/Java/jdk1.8.0_45/bin/javac')<b>{
src(path:compilerSourceFiles)
classpath(path:compilerLibraryFiles)
}</b>
}
build()
내가 변환 할 수 없습니다 오전 Ant 스크립트의 일부 :
<!-- Compiler Source File Definition -->
<path id="compilerSourceFiles">
<pathelement path="${Sources}" />
<pathelement path="${projectDomainModel}/${foreignSources}" />
<pathelement path="${projectPresentationBase}/${foreignSources}" />
<pathelement path="${projectServices}/${foreignSources}" />
</path>
<!-- Compiler Library Definition -->
<path id="compilerLibraryFiles">
<fileset id="librariesDomainModel" dir="${projectDomainModel}/${projectLibraries}">
<include name="**/*.jar" />
</fileset>
<fileset id="librariesPresentationBase" dir="${projectPresentationBase}/${projectLibraries}">
<include name="**/*.jar" />
</fileset>
<fileset id="librariesServices" dir="${projectServices}/${projectLibraries}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${j2eeLibraries}">
<include name="**/*.jar" />
</fileset>
</path>
<target name="executeCompiler" depends="preCompile">
<javac destdir="${deployBuild}" target="${compileTarget}"
debug="true" debuglevel="lines,vars" encoding="ISO8859-1">
<src refid="compilerSourceFiles" />
<classpath refid="compilerLibraryFiles" />
</javac>
</target>
내 의견이 너무 길어서 대답에 넣었습니다. :) Btw, 큰 따옴표 "와 작은 따옴표 '를 사용합니까? – Denyo
두 따옴표는 모두 groovy에서 유효합니다. 문자열에 $ {} 표현식이 필요하지 않으면 single을 사용하십시오. –