The Java Client libraries for Ads APIs are some of the most popular, used by thousands of developers each day to manage their AdWords, DFA and DFP accounts. Since they were initially written years ago, we’ve gotten a lot of feedback from developers using the libraries. We’ve tried to incorporate as many suggestions as possible, but due to the legacy architecture, certain changes were not feasible.

Today we’re pleased to announce that we are officially supporting a new from-scratch rewrite of the Java Library! It is now production-ready and is no longer experimental. Read on for some reasons why you’ll want to take the new library for a spin right away.

New Features

New features in the rewritten library include:
  • Product level support for AdWords, DFA and DFP with shared common layer code.
  • Library is now hosted on Maven.
  • OAuth1.0a and OAuth2.0 support.
  • Uses the SLF4J logging facade.
  • More control over building your session, providing authentication and more.
  • Experimental AppEngine support via JAX-WS.

Migrating

The two biggest changes involve how to configure your session and how to obtain Service objects.

Here’s how you configure an AdWordsSession:
AdWordsSession session = new AdWordsSession.Builder()
    .fromFile()
    .withClientLoginToken(clientLoginToken)
    .build();
Here’s how you obtain a reference to a service:
AdWordsServices adWordsServices = new AdWordsServices();
CampaignServiceInterface campaignService =
    adWordsServices.get(session, CampaignServiceInterface.class);
Check out the migration guide we have recently published on the new project page wiki. You’ll find these procedures described in depth, along with best practices for using these classes.

The new library will be the primary focus of development moving forward. The existing AdWords and DFP java libraries are now in maintenance mode and we will continue to add support for new AdWords and DFP API releases for the near future.

If you find any bugs, have a patch to contribute or just a feature request, please feel free to file an issue on our issue tracker.