Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

ANT Interview Questions and Answers

Ques 6. Explain how to import .jar files?

<path id="classpath.base">
<pathelement location="${glassfish.home}/lib/javaee.jar" />
<fileset dir="${lib.dir}">
<include name="log4j-1.2.15.jar" />
<include name="el-impl-1.0.jar" />
</fileset>
</path>

Is it helpful? Add Comment View Comments
 

Ques 7. Explain how to use clean in Ant script?

<target name="clean" depends="-clean" />
<target name="-clean">
<delete dir="${build.dir}/*" />
<delete dir="${build.dir}/classes" />
<delete dir="${build.dir}/test-classes" />
<delete dir="${build.dir}/release" />
<delete file="${build.dir}/*.jar" />
<delete file="${build.dir}/VERSION.txt" />
</target>

Is it helpful? Add Comment View Comments
 

Ques 8. Explain how to use PMD validation in Ant script?

<target name="validate" depends="-init">
<mkdir dir="${build.dir}/pmd-reports" />
<pmd shortFilenames="true" rulesetfiles="${basedir}/.ruleset">
<formatter type="xml" tofile="${build.dir}/pmd-reports/report.xml" />
<fileset dir="${src.dir}/main/java/com/" includes="**/*.java" />
<fileset dir="${src.dir}/test/java" includes="**/*.java" />
</pmd>
<xslt style="${ant.home}/etc/xslt/pmd-report-per-class.xslt"
in="${build.dir}/pmd-reports/report.xml"
out="${build.dir}/pmd-reports/report.html" />
</target>

Is it helpful? Add Comment View Comments
 

Ques 9. Explain how to compile using Ant script?

<target name="compile" depends="-init">
<mkdir dir="${build.dir}/classes" />
<javac destdir="${build.dir}/classes" includeantruntime="false" debug="true" optimize="true" verbose="false" deprecation="false" source="1.5" target="1.5">
<classpath refid="classpath.base" />
<src path="${src.dir}/main/java" />
</javac>
</target>

Is it helpful? Add Comment View Comments
 

Ques 10. Explain how to test classes for JUnit using Ant script?

<target name="test" depends="-copytestresources, compile">
<mkdir dir="${build.dir}/junit-reports" />
<junit printsummary="false"
fork="on"
haltonfailure="false"
failureproperty="test.failure">
<classpath refid="classpath.junit" />
<formatter type="plain" />
<batchtest todir="${build.dir}/junit-reports">
<fileset dir="${build.dir}/test-classes" includes="**/*Test.class" />
</batchtest>
</junit>
<junitreport tofile="target/junit-reports/TEST.xml">
<fileset dir="${target}/junit-reports" includes="TEST-*.xml" />
<report format="frames" todir="${target}/junit-reports" />
</junitreport>
</target>

Is it helpful? Add Comment View Comments
 

Most helpful rated by users:

©2024 WithoutBook