{"id":513,"date":"2010-04-10T17:40:04","date_gmt":"2010-04-10T15:40:04","guid":{"rendered":"http:\/\/misto.ch\/?p=140"},"modified":"2010-04-10T17:40:04","modified_gmt":"2010-04-10T15:40:04","slug":"eclipse-plugins-scala-maventycho","status":"publish","type":"post","link":"https:\/\/misto.ch\/de\/2010\/04\/10\/eclipse-plugins-scala-maventycho\/","title":{"rendered":"Building Eclipse Plug-ins Written in Scala with Maven\/Tycho"},"content":{"rendered":"<p>The Scala Refactoring project currently uses a rather crude hand-written ant build file; it compiles and runs tests. What it doesn&#8217;t do is creating a proper OSGi bundle, which I need if I want to do proper releases and integrate it into the Scala Eclipse IDE. Most of my colleagues are using PDE build, but from what I&#8217;ve heard, <a href=\"http:\/\/www.eclipse.org\/buckminster\/\">Buckminster<\/a> or <a href=\"http:\/\/tycho.sonatype.org\/\">Maven\/Tycho<\/a> are the way to go.<\/p>\n<p>Buchminster looks rather complex to me, so I went with Maven, even though I had no prior experience with it. Now, a few hours later, I have a <em>Hello World<\/em> plug-in written in Scala and a bunch of poms that build everything I want, even an update site! <\/p>\n<p>Tycho needs Maven 3, which hasn&#8217;t been released yet, so I downloaded the latest <a href=\"http:\/\/maven.apache.org\/download.html\">alpha build<\/a> and created an alias that pointed to the mvn binary.<\/p>\n<p>I started with <a href=\"http:\/\/mattiasholmqvist.se\/2010\/02\/building-with-tycho-part-1-osgi-bundles\/\">Mattias Holmqvist&#8217;s Blog<\/a> where he explains how to create the initial Maven configuration and an OSGi bundle in Eclipse (I created a Hello World Plug-in Project). Now, we don&#8217;t want to have a Java plug-in but one written in Scala, so I added the Scala Nature to the project and re-wrote the two generated files in Scala.<\/p>\n<p>To add Scala functionality to my pom, I followed the <a href=\"http:\/\/code.google.com\/p\/esmi\/wiki\/CreatingScalaMavenProjectsInEclipse\">Eclipse Scala Maven Integration wiki<\/a>. I also had to add the Scala Eclipse Plug-in nightly build update site to my list of repositories so Maven could resolve the <em>scala.library<\/em> dependency the project has. <\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">    &lt;repository&gt;\n       &lt;id&gt;scala eclipse nightly&lt;\/id&gt;\n       &lt;layout&gt;p2&lt;\/layout&gt;\n       &lt;url&gt;http:\/\/download.scala-ide.org\/scala-eclipse-toolchain-osgi-2.9.1.final\/&lt;\/url&gt;\n    &lt;\/repository&gt;\n<\/pre>\n<p>Because I apparently didn&#8217;t follow Maven&#8217;s source layout, I had to explicitly specify the source directory via: <\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">&lt;sourceDirectory&gt;${basedir}\/src&lt;\/sourceDirectory&gt;<\/pre>\n<p>Adding the update site and feature projects was a peace of cake when following <a href=\"http:\/\/tycho.sonatype.org\/how-to-create-a-new-osgi-bundle.html\">this tutorial<\/a> (scroll to <em>Creating an Update Site \/ P2 repository<\/em>) from the Tycho project.<\/p>\n<p>I&#8217;ve put the whole project on <a href=\"http:\/\/github.com\/misto\/Scala-Hello-World-Plug-in\">GitHub<\/a> so you can try it yourself. And remember, this is my first day with Maven, so if I could make the poms even smaller or more idiomatic, please tell me. Or even better, just fork my code!<\/p>\n<p>Next I&#8217;m going to find out how to run unit tests and how the integration in Hudson works, and then I can migrate the Scala Refactoring project and delete a build.xml file.<\/p>\n<p><strong>Update April 2012:<\/strong> I&#8217;ve updated the <a href=\"https:\/\/github.com\/misto\/Scala-Hello-World-Plug-in\">sample repository<\/a> to the latest versions of Scala, Eclipse and Maven-Tycho.<\/p>\n<p><strong>Update July 2012:<\/strong> Updated the <a href=\"https:\/\/github.com\/misto\/Scala-Hello-World-Plug-in\">sample repository<\/a> to the use Scala 2.9.2, Eclipse Juno and Tycho 0.15.0.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Scala Refactoring project currently uses a rather crude hand-written ant build file; it compiles and runs tests. What it doesn&#8217;t do is creating a proper OSGi bundle, which I need if I want to do proper releases and integrate it into the Scala Eclipse IDE. Most of my colleagues are using PDE build, but [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26,27],"tags":[30,33,38],"class_list":["post-513","post","type-post","status-publish","format-standard","hentry","category-infoq","category-scala","tag-eclipse","tag-maven","tag-scala"],"_links":{"self":[{"href":"https:\/\/misto.ch\/de\/wp-json\/wp\/v2\/posts\/513","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/misto.ch\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/misto.ch\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/misto.ch\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/misto.ch\/de\/wp-json\/wp\/v2\/comments?post=513"}],"version-history":[{"count":0,"href":"https:\/\/misto.ch\/de\/wp-json\/wp\/v2\/posts\/513\/revisions"}],"wp:attachment":[{"href":"https:\/\/misto.ch\/de\/wp-json\/wp\/v2\/media?parent=513"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/misto.ch\/de\/wp-json\/wp\/v2\/categories?post=513"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/misto.ch\/de\/wp-json\/wp\/v2\/tags?post=513"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}