Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get OAuth's java client library with maven?

Tags:

maven

oauth

I'm trying to follow this guide here http://www.ibm.com/developerworks/web/library/wa-oauthsupport/index.html which gives information on how to use the OAuth client library provided by OAuth and HTTPClient 4 to authenticate your connection. I am working on a Java Swing CLIENT, NOT a OAuth PROVIDER.

OAuth provides a client library here on this page http://oauth.net/code/

I'm talking about the one marked by "A Java library and examples were contributed by John Kristian, Praveen Alavilli and Dirk Balfanz." which points to an SVN repository http://oauth.googlecode.com/svn/code/java/core/

I do not understand how to incorporate this library into my Eclipse project. I would like to just be able to add a maven dependency because it's so clean and works so well. I don't see coordinates readily available, and when I look at http://oauth.googlecode.com/svn/code/java/pom.xml I see the following coordinates but they don't work when I run the Maven build with the coordinates, and I get a "Missing artifact net.oauth:oauth-parent:jar:20100601" error in Eclipse's integrated Maven 3 pom.xml manager. I thought the entire point of Mavenizing a project was so that you could use its coordinates to pull it in.

<dependency>
    <groupId>net.oauth</groupId>
    <artifactId>oauth-parent</artifactId>
    <version>20100601</version>
    <packaging>pom</packaging>
</dependency>

I've tried the follow dependency after snooping around on the maven repository, and it didn't have all the classes/interfaces/etc I needed.

<dependency>
    <groupId>net.oauth.core</groupId>
    <artifactId>oauth</artifactId>
    <version>20100527</version>
</dependency>

Is this the wrong way to incorporate this project? Is it not truly mavenized in a way that makes it easy to share? If I can't use Maven, what's the best path to follow to include this library into my project?

This is a bit of a repeat of How to include oauth library in Eclipse? but that question doesn't address the Maven aspect of it at all.

like image 575
Jazzepi Avatar asked Aug 01 '12 04:08

Jazzepi


People also ask

What is Java client library?

The client library provides a fluent API for common tasks and a JavaBeans compatible representation of the IBM® UrbanCode Release object model. The client library relies on the REST API. For more information about the supported operations, see REST API conventions.


2 Answers

The OAUth libs doesn't seem to be available in Maven Central, so you have to add the following repository either to your settings.xml or to your pom.xml:

<repository>
  <id>oauth</id>
  <name>OAuth Repository</name>
  <url>http://oauth.googlecode.com/svn/code/maven</url>
</repository>
like image 99
dunni Avatar answered Sep 20 '22 13:09

dunni


I actually found the way to make it work with exactly your version of oauth-parent:

Create a directory and enter it:

mkdir oauth && cd oauth

Checkout code for your version:

svn co http://oauth.googlecode.com/svn/code/java/

Enter checked out directory (java), compile and deploy jars yourself:

cd java && mvn source:jar install

After that your dependency will work:

<dependency>
    <groupId>net.oauth</groupId>
    <artifactId>oauth-parent</artifactId>
    <version>20100601</version>
    <packaging>pom</packaging>
</dependency>
like image 25
Artem Avatar answered Sep 24 '22 13:09

Artem