Setting up Eclipse Mylyn task management and Trac on Windows

As a consultant, I work on several projects and even tough all projects are for the same client, it’s not easy to keep track of all your tasks and to-do’s. So I decided to have a look at Mylyn, a task management plugin for Eclipse. The plugin works perfectly offline with a local repository, but I don’t want to be tied to my desktop so it would be nice to have some kind of server with which I can synchronize.
By default, you can synchronise Mylyn with Bugzilla, but installing Bugzilla seemed to be rather complex so after a quick look on the internet I found Edgewall Track which is also supported by Mylyn.

Installing Trac
Step 1: install Python 2.7 (http://www.python.org/download/)
Step 2: install Trac using the installer (http://trac.edgewall.org/wiki/TracDownload)
Step 3: copy this file to c:\\Scripts. In my case, it’s in c:\Python27\scripts\ez_setup.py and then execute it (either double click it or call

c:\<path_to_python\python.exe ez_setup.py

Step 4: in c:\<path_to_python\scripts\ run

easy_install.exe Trac

Configuring your Trac environment
Okay, now you have to create a Trac environment, let’s start with putting a single project in c:\TracTest . Initializing the environment can be done using

c:\<path_to_python\scripts\trac-admin.exe c:\TracTest initenv

This will start a wizard, it’s fine if you only fill in the project name (you can leave the other values to their default ones). Trac will install some sample data, I’ll show you how to remove this afterwards 🙂 .
Okay, let’s run Trac:

c:\<path_to_python>\Scripts\tracd.exe -p 8000

If you browse to http://localhost:8000, you should see a list with the available projects, which is a single one: TracTest. Clicking this link shall guide you to the default wiki start page.
Setting up basic authorization
Now Trac is up and running, we want some basic for of authorization. First create a script name trac-digest.py in c:\\Scripts and put this content in it:

from optparse import OptionParser
import md5

# build the options
usage = "usage: %prog [options]"
parser = OptionParser(usage=usage)
parser.add_option("-u", "--username",action="store", dest="username", type = "string",
                  help="the username for whom to generate a password")
parser.add_option("-p", "--password",action="store", dest="password", type = "string",
                  help="the password to use")
(options, args) = parser.parse_args()

# check options
if (options.username is None) or (options.password is None):
   parser.error("You must supply both the username and password")

# Generate the string to enter into the htdigest file
realm = 'trac'
kd = lambda x: md5.md5(':'.join(x)).hexdigest()
print ':'.join((options.username, realm, kd([options.username, realm, options.password])))

By executing the following command, you can add a new username/password to the file c:\tracpass.txt

trac-digest.py -u "username" -p "password" >> c:\tracpass.txt

With the following command you can start Trac with the authorization file:

tracd.exe -p 8000 --auth=TracTest,c:\tracpass.txt,trac c:\TracTest

Now you can try login in 😉 .

Installing XML-RPC support
By default, Trac doesn’t support Mylyn, so we have to install a little plugin for that.
Step 1: download XML-RPC from http://trac-hacks.org/wiki/XmlRpcPlugin
Step 2: unzip it
Step 3: run easy_install -Z -U c:\\trunk
Step 4: start Trac again.
Step 5: go to your Trac page and login. Go to admin > Plugin and open the tracxmlrpc plugin and make sure you check all boxes.
trac_xml_rpc

Surf to http://localhost:8000/TracTest/xmlrpc to make sure the plugin is working. You might need to restart for the changes to work.

Setting up Mylyn
Start Eclipse and open the Task Repositories View (either go to Window > Show View > Task Repositories or Window > Show View > Other and type: Task Repositories). Right click in the view and select “Add Repository”. You’ll be given a view where you can select the connector, by default the Trac Connector isn’t installed. Click “Install More Connectors” to install the connector.
trac_plugin

Once install, select the connector, fill in the data and select “Validate Settings”. If everything goes fine, you should just have to click “Finish”
trac_settings

Well, that’s it.

I have some tips for you:

Running and accessing Trac on an external server
That’s easy 😉 . Just add -B ip.address.of.server to the command line.
So something like:

tracd.exe -p 8000 -b 10.11.12.13 --auth=TracTest,c:\tracpass.txt,trac c:\TracTest

Removing the default wiki
That easy too, run the following script in the root of your project (eg c:\TracTest)

for /f "skip=3 tokens=1" %1 in ('c:\python27\scripts\trac-admin.exe . wiki list') do ( c:\Python27\Scripts\trac-admin.exe . wiki remove %1)

Working with Mylyn
I decided to make a tip out of this because the blog is mostly about installing Trac and setting up Mylyn. But I realise that in the beginning, Mylyn insn’t realy straightforward, so here are a few tips.

Adding a task
Open the Task List view via Window > Show View > Task List or Windows > Show View > Other … and start typing Task List.
Right click in the Task List and select New > Task. Then select your Trac Repository and you should get a view like this:
new_task

Fill in some data and click Submit. Your new task should end under “Uncategorized”.

Organizing tasks
You can organize your tasks using queries. These are simple to setup, right click in the Task List view and select New > Query, select your Trac repository and you should get something like this:
new_query
Select some data that matches the task you just created and normally the task should end up under the query after you click finish.

Happy coding 😉

This post was originally posted on my My.Opera blog on Sunday, May 29, 2011 2:31:30 PM. This post has been copied to my WordPress blog since the My.Opera blogging service will be discontinued.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s