<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>MyBlog &#187; 未分類</title>
	<atom:link href="http://49.212.165.86/?cat=1&#038;feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://49.212.165.86</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Sun, 05 Aug 2012 15:50:43 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4</generator>
		<item>
		<title>How to configure Scala and SBT for Eclipse</title>
		<link>http://49.212.165.86/?p=13</link>
		<comments>http://49.212.165.86/?p=13#comments</comments>
		<pubDate>Sun, 05 Aug 2012 15:50:43 +0000</pubDate>
		<dc:creator>Ken</dc:creator>
				<category><![CDATA[未分類]]></category>

		<guid isPermaLink="false">http://49.212.165.86/?p=13</guid>
		<description><![CDATA[This guide is about how to install Scala and SBT to be  [...]]]></description>
			<content:encoded><![CDATA[<p>This guide is about how to install Scala and SBT to be used together with Eclipse. I have used latest Eclipse 4.2 for this but in general it should not matter what version you use.</p>
<p><strong>Step 1: Download and install Eclipse</strong></p>
<p>Go to www.eclipse.org and download Eclipse. I generally go for Eclipse classic as I like to configure my environment myself. Link to download page is <a title="eclipse" href="http://www.eclipse.org/downloads/" target="_blank">here</a>.<br />
When download finishes install it by extracting and move the extracted folder to a place of your choice. Create a shortcut for easy access to Eclipse.</p>
<p><strong>Step 2: Install Scala IDE for Eclipse</strong></p>
<p>Scala IDE provides nice features for scala development on Eclipse. Installing is done from Eclipse&#8217;s &#8220;Help -&gt; Install new software&#8230;&#8221;. Go to <a title="scala-ide" href="http://scala-ide.org" target="_blank">scala-ide.org</a> to get the URL for the version you would like to install, since I use Eclipse Juno I will pick the current nightly build that is available supporting Juno. Paste the link in the &#8220;Install new software&#8230;&#8221; window of Eclipse and install the plugin.<br />
If you have problems installing, try unchecking &#8220;Contact all update sites&#8221; and disable your firewall/anti-virus software during installation.</p>
<p>When asked to restart Eclipse, choose &#8220;Yes&#8221; and when restarted there will be a dialogue window popping up asking to run setup diagnostics, choose &#8220;Yes&#8221;. Mark &#8220;Use recommended default settings&#8221; and press &#8220;OK&#8221;. There should have been a text telling you about heap size, to change the heap size edit your eclipse.ini file.</p>
<p>If the installation went successfully then you should now be able to use Scala perspective from &#8220;Window -&gt; Open perspective -&gt; Other&#8230; -&gt;Scala&#8221;. There should now be a Scala perspective next to your Java perspective in the top right corner of Eclipse window.</p>
<p><strong>Step 3: Download and install Typesafe stack</strong></p>
<p>Download the typesafe stack <a title="typesafe" href="http://typesafe.com/stack/download" target="_blank">here</a> and install it. Only SBT will be used in this guide, but install all components in the typesafe stack anyway.<br />
Once installed, check that installation was successful by opening a terminal and typing &#8220;sbt&#8221;. If the installation went well this should start downloading Scala from a remote repository. If there are problems accessing the remote repository it can be due to you being behind a proxy or your firewall/anti-virus preventing access. To make sbt work through a proxy you need to add</p>
<p><em>-Dhttp.proxyHost=urlToProxy -Dhttp.proxyPort=portNumber</em></p>
<p>to your sbt.bat file right after &#8220;_JAVA_OPTS=&#8221;.</p>
<p>To leave the sbt prompt, type exit.</p>
<p><strong>Step 4: Create directory structure for SBT</strong></p>
<p>SBT uses same directory structure as maven for source code. Decide where you want your project root to be, I will use Eclipse&#8217;s default &#8220;workspace&#8221; as project root. I will call my project &#8220;myProject&#8221; and place it inside workspace. Then create the following directories:</p>
<p><em>myProject/src/main/scala</em><br />
<em>myProject/src/main/java</em><br />
<em>myProject/src/main/resources</em><br />
<em>myProject/src/test/scala</em><br />
<em>myProject/src/test/java</em><br />
<em>myProject/src/test/resources</em><br />
<em>myProject/lib</em><br />
<em>myProject/project</em></p>
<p><strong>Step 5: Create .sbt files for your project</strong></p>
<p>You will need to create two files. First one should be named build.sbt and be placed in &#8220;/myProject&#8221;. The file should contain the following:</p>
<p><em>name := &#8220;myProject&#8221;</em></p>
<p><em>version := &#8220;0.0.1&#8243;</em></p>
<p><em>scalaVersion := &#8220;2.9.2&#8243;</em></p>
<p>Note that the empty lines inbetween are required.</p>
<p>Second file should be called plugins.sbt and be placed under &#8220;/myProject/project&#8221;. In that file add</p>
<p>addSbtPlugin(&#8220;com.typesafe.sbteclipse&#8221; % &#8220;sbteclipse-plugin&#8221; % &#8220;2.0.0&#8243;)</p>
<p>This plugin will be used for converting your project into an Eclipse project by creating <em>.project</em> and <em>.classpath</em> files</p>
<p><strong>Step 6: Generate and import Eclipse project</strong></p>
<p>From a terminal enter &#8220;/myProject&#8221; directory. Type sbt, this should start downloading a bunch of things from the repository, including the sbteclipse tool that will be used for generating an Eclipse project. When download finishes, type &#8220;eclipse&#8221; in sbt prompt. This will generate the necessary files. Again if you have problems downloading this can be due to firewall/anti-virus software, try disabling those.</p>
<p>When the files have been generated go to Eclipse &#8220;File -&gt; Import&#8230; -&gt; General -&gt; Existing Project into Eclipse&#8221; and pick &#8220;myProject&#8221;.  This imports your project into Eclipse with all the sbt goodies and scala nature!</p>
<p>Currently there seems not to be any good plugin for integration of SBT into Eclipse, but do not worry, SBT is a great tool and easy to use. For example lets add Akka as a dependency to SBT. Add the following lines to your build.sbt.</p>
<p>resolvers += &#8220;Typesafe Repository&#8221; at &#8220;http://repo.typesafe.com/typesafe/releases/&#8221;</p>
<p>libraryDependencies += &#8220;com.typesafe.akka&#8221; % &#8220;akka-actor&#8221; % &#8220;2.0.2&#8243;</p>
<p>This will add the akka dependency for sbt to manage.</p>
<p>Now from sbt prompt hit the following commands: <em>reload</em>,<em> update</em>, <em>eclipse</em>.  Then go to Eclipse and do <em>refresh</em> on your project. This should cause the &#8220;referenced libraries&#8221; to show up, and akka-actor-2.0.2.jar should be found inside.</p>
<p>That was all, hope this is of any help to everyone that reads this!</p>
]]></content:encoded>
			<wfw:commentRss>http://49.212.165.86/?feed=rss2&#038;p=13</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
