gpt4 book ai didi

gradle - 从 Ant 迁移到Gradle

转载 作者:行者123 更新时间:2023-12-03 06:32:42 25 4
gpt4 key购买 nike

Build.xml

<project name="DikshaPortal" default="dist" basedir=".">
<description>Build file for Portalv2.0 project</description>
<!-- set global properties for this build -->

<property name="src" location="src" />
<property name="conf" location="src/conf" />
<property name="build" location="${BUILD_TARGET}/Portal" />
<property name="GUI" location="../GUI" />
<property name="dist" location="${BUILD_EXPORT}/Portal" />
<property name="BaseDir" location="../DikshaPortal-Release-2013-12-12" />
<property name="UIBaseDir" location="../Portalv2.0_FlexCompileFiles" />
<property name="history" location="${UIBaseDir}/history" />
<property name="META-INF" location="WebContent/META-INF" />
<property name="com" location="${UIBaseDir}/com" />
<property name="pages" location="${UIBaseDir}/pages" />
<property name="WEB-INF" location="WebContent/WEB-INF" />
<property name="data" location="WebContent/data" />
<property name="temp" location="WebContent/temp" />
<property name="policies" location="WebContent/assets/images/Policies" />
<property name="TPL" value="${LIBRARIES}/ThirdParty" />
<property name="apache" value="${TPL}/apache_libs" />

<path id="classpath">
<fileset dir="${TPL}" includes="*.jar" />
<fileset dir="${apache}" includes="**/*.jar" />
<fileset dir="${WEB-INF}" includes="**/*.jar" />
</path>

<target name="clean" description="Removes the temporary directories used">
<delete dir="${GUI}" />
<delete dir="${build}" />
</target>

<target name="init" depends="clean">
<!-- Create the time stamp -->
<tstamp />
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}" />
<mkdir dir="${dist}" />
<mkdir dir="${GUI}" />
<mkdir dir="${data}" />
<mkdir dir="${temp}" />
</target>

<target name="compile" depends="init" description="Compile the source code">
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}" debug="on" debuglevel="lines,vars,source" classpathref="classpath" />
</target>


<target name="dist" depends="compile" description="generate the distribution">

<copy todir="${GUI}">
<fileset dir="${UIBaseDir}" includes="*.js,*.html,*.swf,*.jsp,favicon.png,favicon.ico" />
</copy>
<mkdir dir="${GUI}/assets/images/Policies" />
<copy todir="${GUI}/assets/images/Policies">
<fileset dir="${policies}" includes="*.*" />
</copy>
<mkdir dir="${GUI}/data" />
<copy todir="${GUI}/data">
<fileset dir="${data}" includes="**" />
</copy>
<mkdir dir="${GUI}/temp" />
<copy todir="${GUI}/temp">
<fileset dir="${temp}" includes="*.*" />
</copy>
<mkdir dir="${GUI}/history" />
<copy todir="${GUI}/history">
<fileset dir="${history}" includes="*.*" />
</copy>

<mkdir dir="${GUI}/com" />
<copy todir="${GUI}/com">
<fileset dir="${com}" includes="**" />
</copy>

<mkdir dir="${GUI}/pages" />
<copy todir="${GUI}/pages">
<fileset dir="${pages}" includes="**" />
</copy>

<mkdir dir="${GUI}/WEB-INF/flex" />
<copy todir="${GUI}/WEB-INF/flex">
<fileset dir="${WEB-INF}/flex" includes="*.*">
</fileset>
</copy>

<mkdir dir="${GUI}/WEB-INF/pages" />
<copy todir="${GUI}/WEB-INF/pages">
<fileset dir="${WEB-INF}/pages" includes="*.*">
</fileset>
</copy>

<mkdir dir="${dist}/conf" />
<copy todir="${dist}/conf">
<fileset dir="${BaseDir}/conf" includes="email.properties, Portal.properties" />
</copy>

<copy todir="${dist}">
<fileset dir="${BaseDir}/conf" includes="readme.txt" />
</copy>

<mkdir dir="${dist}/email/templates" />
<copy todir="${dist}/email/templates">
<fileset dir="${BaseDir}/email/templates" includes="*.*" />
</copy>

<mkdir dir="${dist}/jasper" />
<copy todir="${dist}/jasper">
<fileset dir="${BaseDir}/jasper" includes="*.*" />
</copy>

<mkdir dir="${dist}/conf" />
<copy todir="${dist}">
<fileset dir="${BaseDir}/db_scripts" includes="*.*" />
</copy>

<mkdir dir="${dist}/jars" />
<copy todir="${dist}/jars">
<fileset dir="${TPL}" includes="*.*" />
</copy>

<copy todir="${build}" file="src/MessageResources.properties">
</copy>

<!--
Put everything in ${build} into the MyProject-${DSTAMP}.war file
-->
<war destfile="${dist}/DikshaPortalv2.0.war" webxml="${WEB-INF}/web.xml" basedir="${GUI}">
<classes dir="${build}" />
<lib dir="${WEB-INF}/lib" />
<webinf dir="${WEB-INF}" includes="*.xml" excludes="web.xml" />
<fileset dir="${META-INF}" />
</war>

<copy todir="${build}">
<fileset dir="${dist}" includes="*.war" />
</copy>


<delete dir="${GUI}" />
<delete dir="${build}" />

</target>

Iam completely new to gradle, I was told to migrate the existing antscript into gradle at my company. Somebody please help me on How toconvert the above given ant script into gradle.

Iam completely new to gradle, I was told to migrate the existing antscript into gradle at my company. Somebody please help me on How toconvert the above given ant script into gradle.

最佳答案

我将从DikshaPortal项目的根目录中的一个非常基本的build.gradle文件开始,从终端或命令行运行gradle build,看看会发生什么。您了解这个项目的依赖性吗?如果是这样,则可以将该块添加到gradle脚本中。

apply plugin: 'war'

dependencies {
//enter your dependenices here such as
compile group: 'com.junit' name: 'junit' version: '4.12'
}

这是一个开始。 Gradle文档很不错,所以我开始熟悉它们。在我作为开发人员的第一份工作中,我刚刚完成了一个不错的规模项目,将Ant转换为Gradle,这花了一段时间!运行gradle构建以检查错误。即使成功,也要检查您对 Ant 的 war (或任何生成的 Artifact )并继续前进。希望能有所帮助。

https://gradle.org/guides/

https://github.com/shekhargulati/gradle-tips

http://dougborg.org/what-makes-a-good-build-dot-gradle

https://docs.gradle.org/3.3/dsl/您可以将版本更改为所使用的版本。

关于gradle - 从 Ant 迁移到Gradle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48761285/

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