HowTo Mylyn » History » Revision 55
Revision 54 (Morty Morty, 2018-06-08 12:01) → Revision 55/58 (Morty Morty, 2018-06-08 12:06)
h1. HowTo connect a Mylyn repository to Redmine {{>TOC}} These instructions should work with redmine 0.9 stable and up. There are 2 options to connect Mylyn to redmine: either install the connector in your redmine install (this obviously needs the ability to install a plugin on the redmine you want to use it with), or use the generic web connector, which scraps the html pages for the information it needs, and thus should work with pretty much every up-to-date enough redmine installation out there. h2. Using specialized Redmine-Mylyn connector The Redmine Mylyn Connector is under "volatile" development. So you will find multiple pages and forks, here are some jump points. http://www.redmine.org/boards/1/topics/10923 http://sourceforge.net/projects/redmin-mylyncon/ - Eclipse 4.x : https://github.com/ljader/redmine-mylyn-plugin http://danmunn.github.io/redmine_mylyn_connector/ (Currently, https://github.com/joaopedrotaveira/redmine_mylyn_connector has better Redmine 3.x.x compatibility) h3. The sourceforge way The "Redmine-Mylyn Connector":http://sourceforge.net/projects/redmin-mylyncon/ is another solution providing better integration with Mylyn (Note: for version 2 of Redmine, the updated redmine plugin can be found "here":http://danmunn.github.com/redmine_mylyn_connector and also an updated Redmine connector plugin for Eclipse (Mylyn) which solves some problems with newer versions (Eclipse 4.x) is "here":https://github.com/ljader/redmine-mylyn-plugin). p=. !redmin-mylyncon.png! h2. Using the generic web repository connector "Mylyn":http://www.eclipse.org/mylyn is an Eclipse plugin for task management. This HowTo explains how to connect to Redmine using the generic web repository connector. Note that the generic web repository connector is not part of the default Mylyn install. So, you have to install it first from the "_incubator_ update site":http://download.eclipse.org/mylyn/incubator/3.8. h3. Create a Task Repository # Right-click on the task repositories list and click *Add task repository* # Choose _Web Template (Advanced)_ and click *Next* # Configure the repository: <pre> Server: http://www.redmine.org -- Replace it with the URL of your Redmine instance Task URL: ${serverUrl}/issues/ New task URL: ${serverUrl}/projects/foo/issues/new -- Replace foo with the identifier of the project used for new tasks Query request URL: ${serverUrl}/issues Query pattern: <td class="subject">.*?<a href="/issues/(\d+)">(.+?)</a></td> Login request URL: ${serverUrl}/login?username=${userId}&password=${password}&authenticity_token=${loginToken} [POST] Login Form URL: ${serverUrl}/login Login Token Pattern: <input name="authenticity_token" type="hidden" value="(.+?)"> </pre> If you have problems with login, maybe try this (mind the end <pre> Login Token Pattern: <input name="authenticity_token" type="hidden" value="(.+?)" /> </pre> Example: p=. !mylyn-repository-properties-2.png! You can replace the _Query request URL_ parameter with the following if you want to get only the issues that are assigned to you: ${serverUrl}/issues?set_filter=1&assigned_to_id=me The following Query pattern value reads Status, Owner and Tracker fields too (Mylyn 3.2.1) : <pre> <td class="tracker">({Type}.+?)</td><td class="status">({Status}.+?)</td>.+?<td class="subject">.*?<a href=".*?/issues/({Id}\d+)">({Description}.+?)</a></td>({Optional}<td class="assigned_to"><a href.+?>({Owner}.+?)</a></td>)?</pre> Status is read as "uncomplete" or "complete" in Eclipse. h3. Create a Query * On the task list, right-click and choose *New* -> *Query...* * And select your newly created repository p=. !mylyn-task-list.png! h2. Web Templates on Redmine 3.3+ The following information applies to Redmine versions 3.3+ and Eclipse Neon (4.6) and will make use of the REST Interface and API Key. (Also see screenshots above on where to find the configuration options.) h3. Prerequisites Installed Redmine 3.3+, Eclipse 4.6+ Add MyLyn Incubator: http://download.eclipse.org/mylyn/incubator/latest/ Install _Mylyn Tasks Connector: Web Templates (Advanced) (Incubation)_ h3. Add new MyLyn Repository Server: your server URL Label: Your Label check "Anonymous" box Click _Additional Settings_, add 3 Parameters: key -> your API key projectId -> your project name limit -> 100 Click _Advanced Configuration_ <pre> Task URL: ${serverUrl}/issues/ New Task URL: ${serverUrl}/projects/${projectId}/issues/new Query Request URL: ${serverUrl}/issues.xml?key=${key}&project_id=${projectId}&limit=${limit} Query Pattern: <issue><id>({Id}\d+)<\/id>.*?<tracker id="\d+" name="({Type}.*?)"\/><status id="\d+" name="({Status}.*?)"\/>.*?<assigned_to id="\d+" name="({Owner}.*?)"\/>.*?<subject>({Description}.*?)<\/subject> </pre> Alternative Query Pattern that also works when a ticket is not assigned to someone (not very well tested yet): <pre> <issue><id>({Id}\d+)<\/id>.*?<tracker id="\d+" name="({Type}.*?)"\/><status id="\d+" name="({Status}.*?)"\/>.*?(?:<assigned_to id="\d+" name="({Owner}.*?)"\/>.*?)?<subject>({Description}.*?)<\/subject> </pre> Leave the rest as is. h3. Create new Query Adapt Parameters, if necessary. You can add your own parameters to taylor the list further. For example tp only query your own tasks use: <pre> ${serverUrl}/issues.xml?key=${key}&project_id=${projectId}&limit=${limit}&assigned_to_id=me </pre> More information can be found inside the "REST Documentation":http://www.redmine.org/projects/redmine/wiki/Rest_Issues h3. General notes If you want to use the connection as mentioned above via HTTP, you need to adapt the Login Token Pattern. It is with current Redmine versions as follow: <pre> <input type="hidden" name="authenticity_token" value="(.+?)" /> </pre>