Error post Ant Compile | Selenium Forum
M
Posted on 30/01/2017
Hi,

I am on module 9 and trying to compile code with Ant for the first time (I am Mac user). I have downloaded the jars from the link given.

I have modified the build.xml document jars path as suggested in the video (copying here for ref).

<property name="ws.jars" value="/Users/vidhantrivedi/Documents/Selenium_Pack_Nov/jars"/>

I am getting attached error post compilation, pls suggest. Thank you.

Regards,
Vidhan

M
Replied on 30/01/2017

testng jar files are missing. add them to your ant jars folder.

PS: next time send a screenshot of the problem, instead of the text file.


M
Replied on 31/01/2017

Hello Ashish,

Thanks for reply. I did below things:

1) I moved all jar files I had downloaded from your code link (including testang.jar) to 'Ant > lib' folder (where there were many jars already present).

2) In eclipse, I tried to Runas build.xml as ANT build and this response (pls note that I havent made any change in the main code i.e. class files)

Buildfile: /Users/vidhantrivedi/workspace/TestNG_Tutorial_Mod9/build.xml
usage:
[echo] ant run will execute the test
[echo]
BUILD SUCCESSFUL
Total time: 424 milliseconds

Still when I run 'ant compile' from command prompt, I get the same error.

Kindly suggest what mistake am I doing here pls.

error is:
-----------------------------------------
Buildfile: /Users/vidhantrivedi/workspace/TestNG_Tutorial_Mod9/build.xml

setClassPath:

init:

clean:
[delete] Deleting directory /Users/vidhantrivedi/workspace/TestNG_Tutorial_Mod9/build

compile:
[echo] making directory...
[mkdir] Created dir: /Users/vidhantrivedi/workspace/TestNG_Tutorial_Mod9/build
[echo] classpath------: /Users/vidhantrivedi/Selenium_Pack_Nov/jars/SaxonLiaison.jar:/Users/vidhantrivedi/Selenium_Pack_Nov/jars/commons-beanutils-1.8.0.jar:/Users/vidhantrivedi/Selenium_Pack_Nov/jars/derbyclient.jar:/Users/vidhantrivedi/Selenium_Pack_Nov/jars/dom4j-1.1.jar:/Users/vidhantrivedi/Selenium_Pack_Nov/jars/eclipselink-2.0.0.jar:/Users/vidhantrivedi/Selenium_Pack_Nov/jars/flash-selenium.jar:/Users/vidhantrivedi/Selenium_Pack_Nov/jars/javax.persistence-2.0.0.jar:/Users/vidhantrivedi/Selenium_Pack_Nov/jars/log4j-1.2.14.jar:/Users/vidhantrivedi/Selenium_Pack_Nov/jars/logging-selenium-1.2.jar:/Users/vidhantrivedi/Selenium_Pack_Nov/jars/mail.jar:/Users/vidhantrivedi/Selenium_Pack_Nov/jars/mysql-connector-java-5.0.7-bin.jar:/Users/vidhantrivedi/Selenium_Pack_Nov/jars/poi-3.6-20091214.jar:/Users/vidhantrivedi/Selenium_Pack_Nov/jars/poi-ooxml-3.6-20091214.jar:/Users/vidhantrivedi/Selenium_Pack_Nov/jars/poi-ooxml-schemas-3.6-20091214.jar:/Users/vidhantrivedi/Selenium_Pack_Nov/jars/saxon-8.7.jar:/Users/vidhantrivedi/Selenium_Pack_Nov/jars/selenium-java-client-driver-sources.jar:/Users/vidhantrivedi/Selenium_Pack_Nov/jars/selenium-java-client-driver-test-sources.jar:/Users/vidhantrivedi/Selenium_Pack_Nov/jars/selenium-java-client-driver-tests.jar:/Users/vidhantrivedi/Selenium_Pack_Nov/jars/selenium-java-client-driver.jar:/Users/vidhantrivedi/Selenium_Pack_Nov/jars/selenium-server-coreless.jar:/Users/vidhantrivedi/Selenium_Pack_Nov/jars/selenium-server-sources.jar:/Users/vidhantrivedi/Selenium_Pack_Nov/jars/selenium-server.jar:/Users/vidhantrivedi/Selenium_Pack_Nov/jars/testng-xslt-maven-plugin-test-0.0.jar:/Users/vidhantrivedi/Selenium_Pack_Nov/jars/testng.jar:/Users/vidhantrivedi/Selenium_Pack_Nov/jars/validation-api-1.0.0.GA.jar:/Users/vidhantrivedi/Selenium_Pack_Nov/jars/xmlbeans-2.3.0.jar
[echo] compiling...
[javac] /Users/vidhantrivedi/workspace/TestNG_Tutorial_Mod9/build.xml:67: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 3 source files to /Users/vidhantrivedi/workspace/TestNG_Tutorial_Mod9/build
[javac]
[javac] WARNING
[javac]
[javac] The -source switch defaults to 1.8 in JDK 1.8.
[javac] If you specify -target 1.5 you now must also specify -source 1.5.
[javac] Ant will implicitly add -source 1.5 for you. Please change your build file.
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.5
[javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
[javac] /Users/vidhantrivedi/workspace/TestNG_Tutorial_Mod9/src/TestCases/ApplicationTest.java:9: error: package org.testng.asserts does not exist
[javac] import org.testng.asserts.SoftAssert;
[javac] ^
[javac] /Users/vidhantrivedi/workspace/TestNG_Tutorial_Mod9/src/TestCases/ApplicationTest.java:14: error: cannot find symbol
[javac] SoftAssert softAssert;
[javac] ^
[javac] symbol: class SoftAssert
[javac] location: class ApplicationTest
[javac] /Users/vidhantrivedi/workspace/TestNG_Tutorial_Mod9/src/TestCases/RegTest.java:6: error: package org.testng.asserts does not exist
[javac] import org.testng.asserts.SoftAssert;
[javac] ^
[javac] /Users/vidhantrivedi/workspace/TestNG_Tutorial_Mod9/src/TestCases/RegTest.java:11: error: cannot find symbol
[javac] SoftAssert softAssert = new SoftAssert();
[javac] ^
[javac] symbol: class SoftAssert
[javac] location: class RegTest
[javac] /Users/vidhantrivedi/workspace/TestNG_Tutorial_Mod9/src/TestCases/ApplicationTest.java:40: error: cannot find symbol
[javac] softAssert = new SoftAssert();
[javac] ^
[javac] symbol: class SoftAssert
[javac] location: class ApplicationTest
[javac] /Users/vidhantrivedi/workspace/TestNG_Tutorial_Mod9/src/TestCases/RegTest.java:11: error: cannot find symbol
[javac] SoftAssert softAssert = new SoftAssert();
[javac] ^
[javac] symbol: class SoftAssert
[javac] location: class RegTest
[javac] 6 errors
[javac] 4 warnings

BUILD FAILED
/Users/vidhantrivedi/workspace/TestNG_Tutorial_Mod9/build.xml:67: Compile failed; see the compiler error output for details.

Total time: 0 seconds
Vidhans-MacBook-Pro:TestNG_Tutorial_Mod9 vidhantrivedi$
-----------------------------------------

Regards,


M
Replied on 31/01/2017

i'm sorry i made a mistake i meant [color=#FF0000:1r3o004q]extent reports[/color:1r3o004q] jar files.


M
Replied on 02/02/2017

Thanks Ashish, it worked !!


M
Replied on 21/04/2017

I am getting following error , when using ant compile command:
avac] C:\Selenium\workspace\TestNG_Tutorial_Module9\build.xml:67: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 1 source file to C:\Selenium\workspace\TestNG_Tutorial_Module9\build




ERROR:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\DSTEST>cd C:\Selenium\workspace\TestNG_Tutorial_Module9
C:\Selenium\workspace\TestNG_Tutorial_Module9>ant compile
Buildfile: C:\Selenium\workspace\TestNG_Tutorial_Module9\build.xml
setClassPath:
init:
clean:
[delete] Deleting directory C:\Selenium\workspace\TestNG_Tutorial_Module9\build
compile:
[echo] making directory...
[mkdir] Created dir: C:\Selenium\workspace\TestNG_Tutorial_Module9\build
[echo] classpath------: C:\jars\SaxonLiaison.jar:C:\jars\commons-beanutils-1.8.0.jar:C:\jars\derbyclient.jar:C:\jars\dom4j-1.1.jar:C:\jars\eclipselink-2.0.0.jar:C:\jars\flash-selenium.jar:C:\jars\javax.persistence-2.0.0.jar:C:\jars\log
4j-1.2.14.jar:C:\jars\logging-selenium-1.2.jar:C:\jars\mail.jar:C:\jars\mysql-connector-java-5.0.7-bin.jar:C:\jars\poi-3.6-20091214.jar:C:\jars\poi-ooxml-3.6-20091214.jar:C:\jars\poi-ooxml-schemas-3.6-20091214.jar:C:\jars\saxon-8.7.jar:C:\j
ars\selenium-java-client-driver-sources.jar:C:\jars\selenium-java-client-driver-test-sources.jar:C:\jars\selenium-java-client-driver-tests.jar:C:\jars\selenium-java-client-driver.jar:C:\jars\selenium-server-coreless.jar:C:\jars\selenium-ser
ver-sources.jar:C:\jars\selenium-server.jar:C:\jars\testng-xslt-maven-plugin-test-0.0.jar:C:\jars\testng.jar:C:\jars\validation-api-1.0.0.GA.jar:C:\jars\xmlbeans-2.3.0.jar
[echo] compiling...
[javac] C:\Selenium\workspace\TestNG_Tutorial_Module9\build.xml:67: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 1 source file to C:\Selenium\workspace\TestNG_Tutorial_Module9\build
[javac]
[javac] WARNING
[javac]
[javac] The -source switch defaults to 1.8 in JDK 1.8.
[javac] If you specify -target 1.5 you now must also specify -source 1.5.
[javac] Ant will implicitly add -source 1.5 for you. Please change your build file.
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.5
[javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
[javac] C:\Selenium\workspace\TestNG_Tutorial_Module9\src\TestCases\Apllicationtest.java:13: error: cannot find symbol
[javac] throw new SkipException ("Any Reason");
[javac] ^
[javac] symbol: class SkipException
[javac] location: class Apllicationtest
[javac] 1 error
[javac] 4 warnings

BUILD FAILED
C:\Selenium\workspace\TestNG_Tutorial_Module9\build.xml:67: Compile failed; see the compiler error output for details.
Total time: 0 seconds

C:\Selenium\workspace\TestNG_Tutorial_Module9>

Buils.XML:
roject name="Learning TestNG" default="usage" basedir=".">

<!-- ========== Initialize Properties =================================== -->
<property environment="env"/>

<property name="ws.home" value="${basedir}"/>
<property name="ws.jars" value="C[color=#000000][b][b]:\Selenium\workspace\TestNG_Tutorial_Module9\jars"/>
<property name="test.dest" value="${ws.home}/build"/>
<property name="test.src" value="${ws.home}/src"/>
<property name="ng.result" value="test-output"/>

Thanks
Kam

Responsive image

M
Replied on 22/04/2017

must be some jar file that is missing.


M
Replied on 22/04/2017

Do you know which Jar file? or how can I find out which jar file is missing.In previous post AShis mentioned jar file missing, but he mentioned different files for different post.
Thanks


M
Replied on 23/04/2017

i cannot see the full text in command prompt can you upload the full screen shot.