Weird problem with imports in Maven project

0 views
Skip to first unread message

Mario Camou

unread,
Jul 5, 2009, 2:19:31 PM7/5/09
to scala-n...@googlegroups.com
Hi,

I'm running NetBeans 6.7 final with the latest version of the scala-plugin in the repositories. I have a Maven project to which I've added the commons-httpclient-3.1 dependency.

Here's the code I'm having trouble with:

  def search(query:String):Option[Any] = {
    import java.net.URLEncoder.encode
    import org.apache.commons.httpclient.HttpClient  // Problem line
    import org.apache.commons.httpclient.methods.GetMethod  // Problem line

    val method = new GetMethod(baseURI+encode(query))
    new HttpClient.executeMethod(method)
    val response = new String(method.getResponseBody)
    println(response)
    val resp = JSON.parse(response)
    println(resp)
    resp
  }

I typed in both import lines marked as "Problem line" using autocomplete (so I would assume they are correct...and they ARE according to the contents of  commons-httpclient). However, once the line is typed, NetBeans marks the text starting with "httpclient." as an error. The tooltip says that httpclient isn't a member of package org.apache.commons (which it is).

The only lines flagged as errors are the two import lines marked above. However, if I type "new HttpClient." and hit Ctrl+Space, it gets immediately autocompleted to "new HttpClient.<anyname>". I assume that's because the import error above is confusing the autocomplete.

So, am I doing something stupid? Or should I just go ahead and report a bug? Where are bugs tracked for the NetBeans Scala Plugin?

Thanks,
-Mario.

--
I want to change the world but they won't give me the source code.

Caoyuan

unread,
Jul 5, 2009, 9:22:12 PM7/5/09
to scala-n...@googlegroups.com
Try to do a "mvn:install" first.

Mario Camou

unread,
Jul 6, 2009, 5:51:55 PM7/6/09
to scala-n...@googlegroups.com
I've done it and am still getting the same problem. I'm also getting that problem with another dependency too, jackson-mapper-lgpl (from the Codehaus repository), but in this case the autocomplete does not work.

mvn install from the command-line works, as does a "clean and build" from the project's context menu.

-Mario.

--
I want to change the world but they won't give me the source code.


Mario Camou

unread,
Jul 6, 2009, 5:54:58 PM7/6/09
to scala-n...@googlegroups.com
...by "autocomplete does not work" I mean that I type "org.", hit Ctrl+Space, and the list does not include "codehaus". Looking at the Libraries node in the Projects pane I can drill down and see that the dependency does, in fact, include org.codehaus.jackson.map.ObjectMapper.

-Mario.

--
I want to change the world but they won't give me the source code.


Reply all
Reply to author
Forward
0 new messages