0
votes

Getting this error "error: package jxl does not exist" while executing build.xml file using command prompt/hudson tool

I am using Testng+ant to run my existing developed selenium webdriver scripts which are in hybrid+page factory framework

I am able to generate the testngXSLT reports when i have a scripts in a single class i.e., in a functional driven framework.

Below is my Build.xml file.

<?xml version ="1.0" encoding="iso-8859-1"?>

<project name="BulkInvite" default="usage" basedir=".">
    <!-- ========== Initialize Properties =================================== -->
        <property environment="env"/>    
        <property name="ws.home" value="${basedir}"/>
        <property name="ws.jars" value="D:\jar-files"/>
        <property name="test.dest" value="${ws.home}/build"/>
        <property name="test.src" value="${ws.home}/src"/>
        <property name="ng.result" value="test-output"/>

    <target name="setClassPath" unless="test.classpath">
            <path id="classpath_jars">
                <fileset dir="${ws.jars}" includes="*.jar"/>
            </path>
            <pathconvert pathsep=":" 
                property="test.classpath" 
                refid="classpath_jars"/>
        </target>
     <target name="init" depends="setClassPath">
            <tstamp>
                <format property="start.time" pattern="MM/dd/yyyy hh:mm aa" />
            </tstamp>
            <condition property="ANT" 
                value="${env.ANT_HOME}/bin/ant.bat" 
                else="${env.ANT_HOME}/bin/ant">
                        <os family="windows" />
            </condition>
            <taskdef name="testng" classpath="${test.classpath}"
                   classname="org.testng.TestNGAntTask" />

        </target>

        <!-- all -->
        <target name="all">
        </target>

        <!-- clean -->
        <target name="clean">
            <delete dir="${test.dest}"/>
        </target>

        <!-- compile -->
         <!-- compile -->
            <target name="compile" depends="init, clean" > 
                <delete includeemptydirs="true" quiet="true">
                <fileset dir="${test.dest}" includes="**/*"/>
                </delete>
                <echo message="making directory..."/>
                <mkdir dir="${test.dest}"/>
                <echo message="classpath------: ${test.classpath}"/>
                <echo message="compiling..."/>
                <javac 
                    debug="true" 
                    destdir="${test.dest}" 
                    srcdir="${test.src}" 
                    target="1.5" 
                    source="1.5"
                    includeantruntime="true"
                    classpath="${test.classpath}"
                >
                </javac>

              </target>


        <!-- build -->
        <target name="build" depends="init">
        </target>

        <!-- run -->
        <target name="run" depends="compile">
            <testng classpath="${test.classpath}:${test.dest}" suitename="Bulkinvite_Suite">    
                <xmlfileset dir="test-output" includes="BulkinviteExecute.xml"/>
            </testng>
            <!--
            <testng classpath="${test.classpath}:${test.dest}" groups="fast">
                <classfileset dir="${test.dest}" includes="example1/*.class"/>
            </testng>
            -->
        </target>


    <target name="usage">
        <echo>
            ant run will execute the test
        </echo>
    </target>


    <path id="test.c">
            <fileset dir="${ws.jars}" includes="*.jar"/>

    </path>



    <target name="generateReport" >
        <mkdir dir="${ws.home}/XSLT_Reports/output">
        </mkdir>

        <xslt in="${ng.result}/testng-results.xml" style="src/xslt/testng-results.xsl"
            out="${ws.home}/XSLT_Reports/output/index.html" classpathref="test.c" processor="SaxonLiaison" >

             <param name="testNgXslt.outputDir" expression="${ws.home}/XSLT_Reports/output/"/>
             <param name="testNgXslt.showRuntimeTotals" expression="true"/>


        </xslt>
    </target>

    <!--using javax mailjar and javax activation jar trying to send report as zip file  -->

    <target name="sendMail" depends="generateReport">           


    <zip destfile="${ws.home}/XSLT_Reports/output.zip" basedir="${ws.home}/XSLT_Reports/output"/>

    <mail
    tolist="[email protected]"
    from="[email protected]"
    subject="ANT_AUTO_Generated_EMAIL__Hurraih.."
    mailhost="smtp.gmail.com"
    mailport="XXX"
    ssl="true"
    user="[email protected]"
    password="XXXX">
    <attachments>
    <fileset dir="${ws.home}/XSLT_Reports/">
    <include name="**/*.zip"/>
    </fileset>
    </attachments>

    </mail>
    </target>
    </project> 

Not able to find out the mistake ,help me in figuring out a solution...

2

2 Answers

1
votes

check whether you have jxl and jExcel as per the specified location in xml. ie. D:\jar-files

0
votes

Problem is solved: i was having the jxl.jar file in a folder at D drive which is also named jxl.jar, so i had moved the jar file out of the folder and deleted that folder now its working.