gpt4 book ai didi

java - Ant 到 Gradle 迁移- exec 任务

转载 作者:行者123 更新时间:2023-12-01 04:25:38 26 4
gpt4 key购买 nike

下面的任务将一些类文件添加到我的 build.xml 中生成的 jar 并生成 jar 输出。

有人可以帮我将下面的整个任务转换为 gradle 任务吗?我正在将 ant 任务转换为 gradle,我被困在这里。

<target name="generate-was-deployment" depends="init">
<exec executable="${websphere.home}/bin/ejbdeploy.bat" dir="build">
<arg file="${build}/${component.name}.jar"/>
<arg path="${ENV.TEMP}/deploy"/>
<arg file="${build}/${component.name}-deployed.jar"/>
<arg value="-cp"/>
<arg value="&quot;${deploy.classpath}&quot;"/>
<arg value="-keep"/>
</exec>
<delete file="${build}/${component.name}.jar"/>
<move file="${build}/${component.name}-deployed.jar" tofile="${build}/${component.name}.jar"/>
</target>

最佳答案

task generateWasDeployment {
doLast {
exec {
workingDir 'build'
commandLine(['cmd', '/c', "${websphereHome}/bin/ejbdeploy.bat"])
args file("$build/${component.name}.jar")
args ...
args ...
}
delete "$build/${componentName}.jar"
file("$build/${componentName}-deployed.jar").renameTo(file("$build/${componentName}.jar"))
}
}


  • Project.exec(...)
  • Project.delete(...)
  • Project.file(...)
  • 关于java - Ant 到 Gradle 迁移- exec 任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58831692/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com