How to set up Eclipse Helios and Google App Engine for Java the easy way

There is a wealth of information online about Eclipse and Google App Engine (GAE), but I haven’t found any good concise guides to setting up a clean environment quickly.


This outlines how to set up a working Eclipse and Google App Engine for Java environment, with Subversion for code management and Trac for task/tickets. With a eclipse downloaded, it will take about 15 minutes and includes the basic steps needed.

Quick setup

1. Download Eclipse Helios JEE edition (version 3.6):

2. Install Google App Engine (GAE) Eclipse Plug-in:
Look at Help > Install New Software… Add Update Site:
http://dl.google.com/eclipse/plugin/3.6
Add all options.

3. Add Subversion:
Update Site is a part of Helios Update Site. Look at Help > Install New Software… > select Helios – http://download.eclipse.org/releases/helios > Collaboration Tools
Add the Subversion Team connector and Mylyn integration.
On restart add the SVN Kit connector when prompted (latest available)
Change to Subversion Perspective.
Recent perspectives are in the top-right as icons, or choose Window > Open Perspective.
Add Subversion repository locations.

4. Add Mylyn Trac connector (Mylyn is part of the default Helios install):
Update Site is a part of Helios Update Site. Look at Help > Install New Software… > select Helios – http://download.eclipse.org/releases/helios > Collaboration Tools
Change to Planning Perspective.
Add Trac task repository and whatever query you want:
Highly recommend projectlocker for integrated Trac and Subversion hosting for free/cheap. Codesion is also good.

5. Change to Java perspective to start working.
Create a new project, or create a new project from SVN.
File > New > Project > SVN > Project from SVN
Select the appropriate repo and Browse for projects, and expand to choose the project from the trunk.

6. To test / run locally:
  • GAE project: Select project and choose Run > Run As > Web Application (with GAE logo)
  • Regular Java server: Run > Run As > Run on server
  • Console will show test address, normally http://localhost:8888
7. Update SVN:
Right-click project name and choose TeamCommit or TeamUpdate (or Synchronize with Repository to inspect changes)

8. Deploy to GAE:
Click the GAE toolbar icon, or right-click project and choose Google > Deploy to App Engine
Version is deployed with version name specified in WEB-INFappengine-web.xml.
GAE’s control panel / Versions lets you specify “Default” (live) version in use and address of alternative versions.

Recommended additions:
HTML and AJAX dev: Aptana
PHP: Eclipse PHP Development Tools Eclipse PDT
Python: PyDev and Python GAE SDK


Background information and documentation

Development / Test Environment

You don’t have to install Eclipse but it really is the fastest way to get operating with GAE. Without it, you need install the Java SDK and Google App Engine (GAE) SDK locally on your machine.

Google’s own instructions on setting up GAE for Java are here:

SDK and other downloads here:

Eclipse setup

Getting started instructions with more detail:

Highly recommend using the great plugin for Google App Engine that makes it all simple:

Recommend also installing PyDev, PHP Dev Tools, Aptana for ajax dev with the links above. PyDev instructions for another day.

The integrated Subversive subversion plugin in Helios looks after the svn checkouts and commits too (instructions here). A Git plug-in is also available.

Helios also has Mylyn task manager which connects to Trac and gives you integrated task management with the any trac instance too, which absolutely rocks. Highly recommended if you’re using trac and subversion with any language.

The Helios Eclipse downloads are here (current release at time of writing is v3.6 – Helios):

Setting up and using the GAE SDK with eclipse and the local test server is covered here:

Have fun!

 

How to set up the ideal WordPress PHP development environment in Eclipse

I’m really just posting this in case anyone else is looking for help on how to get set up quickly and easily for doing development of WordPress blogs and websites using Eclispe on a local development box.

Everyone at some point needs to set up a blog or simple content-managed website, and although Blogger is great for quick hosted blogsites, and at the other end of the scale web frameworks like Python/Rails are great for custom apps, there is a certain type of site for which WordPress is great.

However, the moment you need to start customizing themes or do any actual dev work, it’s handy to be able to use WordPress with a real development tool like Eclipse. Being able to work in Eclipse brings all the benefits of a sweet IDE, Subversion or other source control, Trac and Mylyn for integrated task management, and first class code editing and debug tools.

I’ve never worked with PHP, so it took me a little while to figure out the best way to get Eclipse set up with PHP and WordPress using PHP Development Tools (PDT), as most of the other references out there talk about PHPEclipse, but the process is straightforward. My set up was with Ubuntu Linux but the steps should be very similar for Mac OSX and Windows.

The basic steps are:
– install Eclipse and PHP Development Tools
– install XAMPP (easy standalone LAMP stack)
– download and set up WordPress and download any themes/plugins
– configure Eclipse projects to point their source to paths linked from XAMPP.

1. Install Eclipse and PDT

I’d recommend the full Eclipse IDE for Java EE Developers Eclipse from http://www.eclipse.org/downloads/ and then install PDT as a plugin from http://www.eclipse.org/pdt/

The easy option if you’re happy to run it standalone is to install Aptana Studio then add the PHP Development Tools (PDT) using the Install Plugins link built in to the starter page:
http://www.aptana.org/studio/download

2. Install XAMPP

XAMPP is a good, easy to configure lamp stack with Apache, MySQL, PHP and more.

There is a good walk-thru of install XAMPP for Ubuntu here:
http://ubuntuforums.org/showthread.php?t=223410

Download XAMPP from http://www.apachefriends.org/

You can either use the bundled myPHPadmin or your regular MySQL Workbench or MySQL GUI tools for administration:
http://dev.mysql.com/downloads/workbench/

Create a wordpress_db database and wordpress_user user account with full privileges on it.

The XAMPP stack runs PHP apps from /opt/lampp/htdocs, so put a link to a working directory in your home path from htdocs with:
cd ~
mkdir ~/public_html
cd /opt/lampp/htdocs
sudo ln -s ~/public_html /opt/lampp/htdocs/$USER

Terminate any existing apache/mysql before running. XAMPP runs from its own /opt/lampp directory separate to any regular apache/mysql servers already installed. There is a neat control panel to bring it up and down.

You can start the server with:
sudo /opt/lampp/lampp start

3. Download WordPress and configure

Download the latest WordPress zip file:
http://wordpress.org/latest.zip

Keep a clean copy somewhere, and for each WordPress project you want to work on, create a folder ~/public/[projectname] and copy the WordPress contents into it.

Customise by adding any downloadable themes to wp-content/themes and plugins to wp-content/plugins.

To save time, I create a master WordPress folder and copy in my favourite themes and regularly used plugins.

4. Configure your project in Eclipse.

Open Eclipse and switch to the PHP Perspective.

Create a new ‘PHP Project’ using the File/New wizard. On the first screen, give the project a name, and select “Create project from existing source” and select the path to the WordPress project folder you created above, and complete the new project wizard.

You can now add this project to source control using a [projectname] right-click “Team/Share Project”, and integrate with tasks etc.

If you make any manual changes to files in the public_html path, remember to right-click the project and Refresh to update them.

Now, to get the WordPress project running, follow the easy WordPress admin installation as per:
http://codex.wordpress.org/Installing_WordPress#Famous_5-Minute_Install

Once you’ve created the database and edited the wp-config.php file, you’ll run the install through a web browser using:
http://localhost/[username]/[projectname]/wp-admin/install.php

Use the wordpress_user and wordpress_db you created earlier.

The WordPress site will run live from the XAMPP Apache path below without needing any further configuration:
http://localhost/[username]/[projectname]

And there you have it. All the power of Eclipse with the simplicity of setting up a WordPress site in PHP.

There are some other useful references here:

PHP Development using Eclipse

Using Eclipse for PHP Development

 

A long time between Macs

I used to be a Mac zealot.

At school, I saved for nearly three years working nights, weekends and holidays to buy my first second-hand Mac. I wrote my first articles for Mac newsletters and magazines. I had Apple’s location pinned on a map of Silicon Valley on my bedroom wall.

Then I lost my religion.

Apple strayed from the faith. They shafted Steve Jobs and with every release drifted further and further away from what had made the Mac special.

Until one day the Mac just didn’t seem so special any more. When I started editing a PC magazine, my Mac found itself shunted off into a cupboard, no longer a computer for someone technical, but the sort of computer you get for newbies and arty people who don’t know really know any better.

But then something odd happened. It was nearly four years ago, about the time I bought my last trusty Toshiba notebook. I started noticing developers at technical conferences doing their sessions and presentations on MacBooks running OS X. I found myself quietly wondering if I should get a Mac. But I didn’t. I dismissed the idea quickly and bought my 17in Toshiba for a ridiculously low cost. Macs have always been more expensive for equivalent hardware. PCs had gotten cheaper and cheaper. Macs stayed expensive.

At first I didn’t think much of it – a couple of Rails and web developers here and there surely didn’t mean too much. And corporate developers were still either running Windows and doing .net or running Linux and doing Java.

But lots of smart developers are drawn to languages like Python and Ruby, and the fact they were suddenly using Macs made me question my bias. By then it was a bias. Macs sucked. As a developer, they were a pain to support. Life would be better if everyone just ran Windows XP and IE. That bias stopped me from seeing that something had changed.

It wasn’t just that the impact of Steve Jobs’ return had percolated through Apple’s culture and it was making sexy consumer products. The iMac, iBook and iPod had been beautiful pieces of industrial design and engineering for sure, and game-changing consumer products. But there was more to it.

As Paul Graham noted in Return of the Mac four years ago, the fact that OS X is built on both Unix and on the user experience foundations from NeXTSTEP is a big deal. Here was brains and beauty. Sexy and geeky. Sleek and powerful. All smoothly working together and humming in harmony.

And Paul Graham isn’t the only one to note the change. Smashing Magazine ran a story earlier this week on the top five reasons developers are switching to Macs.

For the first time since I was at school, I found myself going into computer stores just to play around on Macs. And what stores! Apple’s Stores are shining, glorious retail temples. They are magical. Truly, inspiringly magical. And the Macs they sell have some of that same magic as the original Macintosh 128K. It’s not just the startup sound or smiley face icon either. There is magic in the entire experience of using a Mac again.

So when my aging Toshiba laptop died a painful death, I’d already made up my mind that I’d have to somehow convince @mediamum we needed a Mac more than a car or health insurance or groceries, and to help me scrabble together whatever cards and cash we could and — for the sake of our startup — find the cheapest deal on a Mac possible. It was a real and genuine struggle to get this thing, and even with an incredibly cheap deal it hurt us at the moment when we’re struggling to build a startup, especially when a decent PC would have been much less.

But there is another subtle reason too why having a Mac matters with a startup. The two most important things for any startup are the ability to make stuff, and to pitch it. Pitching on a PC sends a subtle signal of dowdiness and “unsexy”. I don’t think that should be the case. But I’ve watched a lot of pitches and reactions, and the Mac thing matters. It’s definitely elitist. It’s not part of the “computer for the rest of us” ethos. I think if anything Mac users suffer from a “the computer for the best of us” mindset. But little things make a big difference.

When you’re throwing heart and soul into making something, you want to use the best tools you can to make it as good as it can be. And when you pitch it as something important and, yes, sexy and hot, you want to make the best impression you can.

So here I am, tapping away on a MacBook keyboard, working with Ruby and Rails and Eclipse, feeling nearly as darned downright excited about the computer I’m using as the first time I lugged home that original second-hand Mac in its big beige carry bag. Between my Ubuntu dev box, and the MacBook I’ll be living on, I find myself only running Windows in a virtual session or through a remote desktop.

I’m glad to be back in the cult, and feel strangely at home again, as though I’ve found a favourite book that was lost, or unpacked a toy from when I was a kid that’s been packed away in storage.

If there’s anything worse than a reformed zealot, then it’s a zealot anew. I’m afraid that a zealot I am once more, and glad to be so.