Module31 - ANT and Maven Issue | Selenium Forum
M
Posted on 03/04/2016
In Module31, I get below error while trying to execute BAT file from command prompt

[quote:1m8md3my]com.google.common.collect.Multimaps.transformValues(Lcom/google/common/collect/ListMultimap;Lcom/google/common/base/Function;)Lcom/google/common/collect/ListMultimap;

java.lang.NoSuchMethodError: com.google.common.collect.Multimaps.transformValues(Lcom/google/common/collect/ListMultimap;Lcom/google/common/base/Function;)Lcom/google/common/collect/ListMultimap;
at com.google.common.net.MediaType.toString(MediaType.java:708)
at org.openqa.selenium.remote.http.JsonHttpCommandCodec.encode(JsonHttpCommandCodec.java:222)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:139)
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.execute(NewProfileExtensionConnection.java:170)
at org.openqa.selenium.firefox.FirefoxDriver$LazyCommandExecutor.execute(FirefoxDriver.java:380)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:620)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:247)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:129)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:216)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:207)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:120)
at com.testing.TestYahoo.testYahoo(TestYahoo.java:12)[/quote:1m8md3my]

After lot of googling I was able to get past the error by deleting collection folder from Maven downloaded jars.

But after using AntRun plugin by adding AntRun compile phase to MavenPOM.xml, attempting to run [b:1m8md3my]mvn compile[/b:1m8md3my], the collections folder & jars are [b:1m8md3my][color=#FF0000:1m8md3my]re-downloaded[/color:1m8md3my][/b:1m8md3my] by Maven and same above issue repeats.

Please suggest a permanent way to resolve this issue. I have read a couple of posts made here on the same issue and resolution was given to delete duplicate jars. But that doesn't helps any further with AntRun.

Thanks

M
Replied on 03/04/2016

upload your project.


M
Replied on 04/04/2016

[quote="qtpselenium.supp0rt@gmail.com":26o9tjvk]upload your project.[/quote:26o9tjvk]

I have attached the project as zip file.[attachment=0:26o9tjvk]MyMavenProject.zip[/attachment:26o9tjvk]


M
Replied on 05/04/2016

try this

http://stackoverflow.com/questions/2805574/yet-another-ant-junit-classpath-problem


M
Replied on 05/04/2016

[quote="qtpselenium.supp0rt@gmail.com":1armlby5]try this

http://stackoverflow.com/questions/2805574/yet-another-ant-junit-classpath-problem[/quote:1armlby5]

Thanks, but i'm unable to understand the posted solution

[quote:1armlby5]I had the same problem 'multiple versions of ant detected in path for junit'. The problem went away when I renamed by Eclipse_Home directory and removed special characters from it. The path had '[1]' in it which was causing the problem.[/quote:1armlby5]


M
Replied on 05/04/2016

have you tried this

[quote:1okdxnjn]I was getting this only when using the 'fork=true' option to the junit task. It was happening because my ANT_HOME had '..' in it (e.g. '/3rdparth/jboss/jboss-5/../tools'). Once I reduced that path, the 'multiple versions of ant' warning went away.[/quote:1okdxnjn]


M
Replied on 07/04/2016

[quote="qtpselenium.supp0rt@gmail.com":1mrgoqtj]have you tried this

[quote:1mrgoqtj]I was getting this only when using the 'fork=true' option to the junit task. It was happening because my ANT_HOME had '..' in it (e.g. '/3rdparth/jboss/jboss-5/../tools'). Once I reduced that path, the 'multiple versions of ant' warning went away.[/quote:1mrgoqtj][/quote:1mrgoqtj]


I don't have any .. in ANT_HOME. It's an absolute path.

were you able to successfully run my project without running into any issue?


M
Replied on 08/04/2016

no i was not able to run your project. giving me a different error.

the error(bug) you have posted usually occurs when there is a version mismatch between 2 different jar files.


M
Replied on 08/04/2016

[quote="qtpselenium.supp0rt@gmail.com":1bgztp1l]no i was not able to run your project. giving me a different error.

the error(bug) you have posted usually occurs when there is a version mismatch between 2 different jar files.[/quote:1bgztp1l]

Ashish,
The initial reported error is resolved by deleting collection folder from Maven downloaded jars.

However, attempting to run mvn compile, the collections folder & jars are re-downloaded by Maven and same above issue repeats.

I also deleted the ant folder, but it wasn't of any use.


M
Replied on 09/04/2016

i haven't encountered this problem but this might be helpful

http://qnalist.com/questions/5487889/multiple-versions-of-ant-detected-in-path-for-junit


M
Replied on 09/04/2016

[quote="qtpselenium.supp0rt@gmail.com":hx31o9fx]i haven't encountered this problem but this might be helpful

http://qnalist.com/questions/5487889/multiple-versions-of-ant-detected-in-path-for-junit[/quote:hx31o9fx]

still it doesn't helps with the main problem. Could you suggest a solution?
Not sure how is it's working in the video. May be some settings that you had done back then.


M
Replied on 10/04/2016

send me a screen shot after you ran your project i'll match it here with your project.

i think i am getting a different error from you.


M
Replied on 11/04/2016

[quote="qtpselenium.supp0rt@gmail.com":38iivf5m]send me a screen shot after you ran your project i'll match it here with your project.

i think i am getting a different error from you.[/quote:38iivf5m]


ok, i have attached screenshots here for below

1. ant
2. mvn compile

also, ANT_HOME is set to C:\Selenium\apache-ant-1.9.6-bin\apache-ant-1.9.6

Responsive image

M
Replied on 12/04/2016

in maven(pom.xml) change the dependency version of ant to 1.9.6. and then delete the .m2 repo and run everything again and tell me again.


M
Replied on 18/04/2016

[quote="qtpselenium.supp0rt@gmail.com":2gpfse8r]in maven(pom.xml) change the dependency version of ant to 1.9.6. and then delete the .m2 repo and run everything again and tell me again.[/quote:2gpfse8r]

Sorry, but in maven(pom.xml) there is no dependency mentioned for ant. Only below 2 dependencies are mentioned.
I have crossed checked the same in video also.

[code:2gpfse8r] <dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.0</version>
</dependency>
</dependencies>[/code:2gpfse8r]

Am I missing something here? Responsive image


M
Replied on 20/04/2016

Follow-up. No response yet


M
Replied on 21/04/2016

[quote:3klgwzah]Sorry, but in maven(pom.xml) there is no dependency mentioned for ant. Only below 2 dependencies are mentioned.
I have crossed checked the same in video also.
[/quote:3klgwzah]

then how come ant-1.8.1 is in .m2/repo?