1
votes

I have two import in scala on play framework. However play keep telling "me object httpclient is not a member of package org.apache.commons". I did add commons-httplclient.jar as external jar in .classpath(in eclipse). I created a console application in eclipse to verify and there is no error at all when importing these two objects and calling their methods. What is special of play that it cannot find httpclient object?

import org.apache.commons.httpclient.methods.PostMethod
import org.apache.commons.httpclient.methods.StringRequestEntity
1

1 Answers

3
votes

You need to declare the dependency to the library in the build.sbt file. Ex :

libraryDependencies += "org.apache.httpcomponents" % "httpclient:jar" % "4.3.3"

See the play documentation for more details : http://www.playframework.com/documentation/2.2.x/SBTDependencies