Trac and Mylyn integration

At work we use Jira for some projects, but the projects I work on use Trac. For many projects an environment like Trac is sufficient. Recently I started to use Eclipse with Pydev for the Python development. Eclipse features a plugin called Mylyn, which allows you to configure a task repository and directly access the tasks in that repository. This is extremely useful, since the repository can also be an instance of Jira or Trac. To connect Mylyn to these repositories you will need a so-called connector. For Jira there’s the Atlassian Connector for Eclipse and for Trac the standard Eclipse repository already has a Mylyn Connector: Trac available. Make sure this is installed.

Next, we need to install some plugins for Trac. On my setup we use AccountManager for authentication and managing of the password files. To make Mylyn talk with Trac we need to add the XML-RPC as well as the HTTPAuth plugin. The XML-RPC plugin is the one that provides XML-RPC methods for Mylyn to talk with Trac. The HTTPAuth plugin is needed if your Trac’s login has been replaced by AccountManager (as is the typical way to use it). HTTPAuth forces certain URL paths (/xmlrpc, /login/xmlrpc) to use standard authentication.

A typical trac.ini will look like this after enabling the appropriate plugins:

[account-manager]
password_file = /usr/local/projects/project1/svn-auth
password_store = HtPasswdStore
 
[components]
acct_mgr.admin.accountmanageradminpage = enabled
acct_mgr.api.accountmanager = enabled
acct_mgr.htfile.htpasswdstore = enabled
acct_mgr.web_ui.accountmodule = enabled
acct_mgr.web_ui.loginmodule = enabled
acct_mgr.web_ui.registrationmodule = disabled
httpauth.* = enabled
trac.web.auth.loginmodule = disabled
tracrpc.* = enabled
 
[httpauth]
paths = /xmlrpc, /login/xmlrpc

After restarting Apache (with mod_wsgi, of course), if you go to http://trac.example.com/project1/xmlrpc it should present you with a user/password prompt. But most likely this will keep repeating without authorising you. After a bit of head scratching and looking around I found out that that is because mod_wsgi requires to pass authorization through to the WSGI application by means of WSGIPassAuthorization On in the appropriate Apache configuration file.

After all this works, you can configure a new Mylyn repository within Eclipse (Windows > Show View > Other > Tasks > Task Repositories). If you then click the icon that stands for create new repository it will present you with a configuration window for adding new repositories. Select the Trac option, followed by Next. In the Server field you can just add http://trac.example.com/project1, followed by a, for you, descriptive Label for this repository. The User ID and Password are those you use to log into the Trac instance. Under Additional Settings is an option for selecting the Access Type, make sure you select XML-RPC here. Ensure that Task Editor Settings has TracWiki selected. Now, by selecting Validate Settings, you ought to see a message stating “Authentication credentials are valid” at the top of the window.

That’s it. You can now follow the Mylyn User Guide.