The Artima Developer Community
Sponsored Link

Java Buzz Forum
Blogging via Ant with the Blogger API

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Simon Brown

Posts: 636
Nickname: simonbrown
Registered: Jun, 2003

Simon Brown is a Java developer, architect and author.
Blogging via Ant with the Blogger API Posted: Apr 25, 2004 11:10 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Simon Brown.
Original Post: Blogging via Ant with the Blogger API
Feed Title: Simon Brown's weblog
Feed URL: http://www.simongbrown.com/blog/feed.xml?flavor=rss20&category=java
Feed Description: My thoughts on Java, software development and technology.
Latest Java Buzz Posts
Latest Java Buzz Posts by Simon Brown
Latest Posts From Simon Brown's weblog

Advertisement

I've often thought that it would be nice to be able to blog from Ant and, while discussing some stuff over at JavaRanch, Gregg has given me an opportunity to put some simple code together. Being able to blog from Ant opens up a few opportunities if you think about using a blog as a project diary.

  • Publishing Ant build/test reports
  • Publishing release information such as change logs

So, after a bit of hacking I came up with a simple Ant task that posts a blog entry via the Blogger API. I'm going to include it in the next Pebble release but if you want to give it a go now, you'll need pebble-ant.jar and xmlrpc-1.1.jar (you'll need to right click and "Save as..." because the MIME type isn't set correctly). Just drop these both onto your classpath before starting Ant and then use the following in your build.xml file, changing the attributes as necessary.

  <taskdef name="postToBlog" classname="pebble.ant.BloggerAPITask"/>

  <!-- content must use escaped HTML/XML tags -->
  <property name="content" value="&lt;p&gt;Hello from Ant!&lt;/p&gt;"/>

  <!-- example of how to post to a blog -->
  <target name="example">
    <postToBlog
      url="http://localhost:8080/blog/xmlrpc"
      handler="blogger"
      blogid="test"
      username="simon"
      password="password"
      title="Hello"
      content="${content}" />
  </target>

There's also a category attribute but you'll need to be posting to Pebble 1.4.2 to be able to use this because I've extended the Blogger API to allow entries to be categorised. If your blogging system supports the Blogger API and expects blog entry titles to be wrapped up within <title> tags at the start of the blog entry text then it should work.

Read: Blogging via Ant with the Blogger API

Topic: Gregory Benford and J2EE Previous Topic   Next Topic Topic: justgroovy.org - Groovy News Site Now Live

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use