sanjivsingh / stackoverflow-java-sdk

26 stars 17 forks source link

Cannot compile/install #1

Closed hawkinsw closed 9 years ago

hawkinsw commented 9 years ago

Sorry for the basic question, but I am following the installation procedure and having trouble. I am running

mvn clean install

and get the necessary jar files. However, when I attempt to run a query:

StackExchangeApiQueryFactory factory =
  StackExchangeApiQueryFactory.newInstance(SE_KEY,
    StackExchangeSite.fromValue("stackoverflow"));
AdvanceSearchApiQuery query = factory.newAdvanceSearchApiQuery();

query.reset();
PagedList<Question> question = query
  .withQuery("test")
  .withTags("lucene,java")
  .withAccepted(true).list();

I get the following error:

 [java] Exception in thread "main" java.lang.UnsupportedOperationException: Method 'com.google.code.stackexchange.client.advanceSearchQuestions' not supported.
 [java]     at com.google.code.stackexchange.client.provider.url.DefaultApiUrlBuilder.withMethod(DefaultApiUrlBuilder.java:168)
 [java]     at com.google.code.stackexchange.client.query.impl.AdvanceSearchApiQueryImpl.list(AdvanceSearchApiQueryImpl.java:172)
 [java]     at edu.virginia.cs.GoldenCode.main(GoldenCode.java:26)
 [java] Java Result: 

Interestingly, all of the "tests" during build fail with very similar messages. I'm obviously doing something wrong but can't figure out what. Any help you could provide would be awesome! Thanks for taking over the support of this package -- it's exactly what I need! :-)

Will

hawkinsw commented 9 years ago

I found out some debugging information:

It looks like the advanceSearchQuestions URL is not available in the StackOverflowApiUrls.properties file. I don't know how to make it, but I know it isn't there :-)

On a related note, several of the Api URLs now require a site parameter. It is missing from the Api Urls. Adding it will make the tests start to work again!

sanjivsingh commented 9 years ago

Hi Will,

Thanks for adding site parameter in URLs. I also verified that working with the changes.

sanjivsingh commented 9 years ago

I ahve updated StackOverflowApiUrls.properties file for missing SOF URLs and site parameter. Please take latest and try that. Let me know if still facing issues.

hawkinsw commented 9 years ago

I will give it a try! Thanks for all your great work on this!