Maven/Ant Integration(java.lang.NoSuchFieldError:INSTANCE) | Selenium Forum
M
Posted on 19/11/2015
Issue:

In the third video of module-31, when you integrate ANT (buid.xml) with Maven and when you execute the two tests GoogleTest.java and YahooTest.java by calling the BAT file “testrunner”, it runs successfully in the video.

I added the codesnippet for “maven-ant-run” plugin in POM.XML and tried executing my bat file “testrunner” and I am getting an error stating “java.lang.NoSuchFieldError: INSTANCE”. Prior to the inclusion of “maven-ant-run” plugin, when I tried the command “mvn package” both the tests got executed successfully. Only after I included the maven ant plugin part, I am facing this issue. Not sure what is wrong.

The selenium version that I am using is 2.48.2 (mentioned the same in the dependency in POM) and the junit version is 4.12. Attaching the screenshot which shows the error when I try executing the testrunner.BAT file and as well I am attaching the INDEX.html report for your reference.

Please help me resolve this issue.

M
Replied on 19/11/2015

there are 2 version of junit jar file please delete one of them.

Responsive image

M
Replied on 03/02/2016

Well, I did delete one of junit files from "C:\Users\aselva\.m2\repository\org\apache". After that when i tried executing the bat file testrunner, I am getting the below file and error. Not sure is its still because of duplicate JAR file. Please help.

Responsive image

M
Replied on 03/02/2016

which one did you delete? older version or newer?


M
Replied on 03/02/2016

Actually, under my "C:\Users\aselva\.m2\repository\junit\junit" folder there are 3.8.1, 3.8.2 and 4.12 folders. Every folder has a JUNIT jar in it.

Other than that, in this folder "C:\Users\aselva\.m2\repository\org\apache" there was an other folder names "ant" and within it there is 1.8.1. I have deleted this one and tried and the attached error is thrown. So its older version.


M
Replied on 03/02/2016

delete entire .m2 repo

and then once pom.xml and then try to execute with ant(build.xml)