2013-04-10 7 views
5

私はスカラを学び、フレームワークをプレイしようとしています。私はideとしてIntelliJ Ideaを選んだ。問題は、 のような輸入の警告を与えるエディタです。 "未使用輸入明細書"IntelliJのプレーフレームワークを使用した、未使用の読み込みステートメントをスカラー

import play.api._ 
import play.api.mvc._ 

また、 「シンボルコントローラを解決できません」

object Login extends Controller 

警告を削除するにはどうすればよいですか?

手順に従います。

playコマンドでテンプレートアイデアプロジェクトを作成します。

スカラコンパイラとライブラリを外部ライブラリに追加します。

IntelliJのアイデアバージョン:(!私は再生使用している2.1.0)12.1コミュニティEditon

+0

'Scala'プラグインを有効にしましたか?私はPlay!と言って悲しいです!フレームワークはUltimateエディション[IntelliJ IDEA Editions比較](http://www.jetbrains.com/idea/features/editions_comparison_matrix.html)でのみサポートされています。しかし、私はそれがこの問題と関係があるのか​​どうかはわかりません。 – maba

+0

yeapはすでにscalaプラグインを有効にしています。私は究極のエディションは残念ながら解決策だと思う。 –

+0

私は通常アルティメットエディションを実行しますが、今はコミュニティエディションをインストールしましたが、あなたと同じエラーは発生しません。コントローラーは問題ありません。 – maba

答えて

5

これは私がそれをやった方法ですに:

C:\dev>play new community 
     _   _ 
_ __ | | __ _ _ _| | 
| '_ \| |/ _' | || |_| 
| __/|_|\____|\__ (_) 
|_|   |__/ 

play! 2.1.0 (using Java 1.7.0_15 and Scala 2.10.0), http://www.playframework.org 

The new application will be created in C:\dev\community 

What is the application name? [community] 
> 

Which template do you want to use for this new application? 

1    - Create a simple Scala application 
2    - Create a simple Java application 

> 1 
OK, application community is created. 

Have fun! 


C:\dev>cd community 

C:\dev\community>play idea 
[info] Loading project definition from C:\dev\community\project 
[info] Set current project to community (in build file:/C:/dev/community/) 
[info] Trying to create an Idea module community 
[info] Updating {file:/C:/dev/community/}community... 
[info] Done updating. 
[info] Excluding folder target 
[info] Created C:\dev\community/.idea/IdeaProject.iml 
[info] Created C:\dev\community\.idea 
[info] Excluding folder C:\dev\community\target\scala-2.10\cache 
[info] Excluding folder C:\dev\community\target\resolution-cache 
[info] Excluding folder C:\dev\community\target\streams 
(commons-codec_commons-codec_1.6_test,List(commons-codec_commons-codec_1.3)) 
(org.apache.httpcomponents_httpcore_4.1.3_test,List(org.apache.httpcomponents_httpcore_4.0.1)) 
(org.apache.httpcomponents_httpclient_4.1.2_test,List(org.apache.httpcomponents_httpclient_4.0.1)) 
[info] Created C:\dev\community\.idea_modules/community.iml 
[info] Created C:\dev\community\.idea_modules/community-build.iml 

C:\dev\community>play compile 
[info] Loading project definition from C:\dev\community\project 
[info] Set current project to community (in build file:/C:/dev/community/) 
[info] Compiling 5 Scala sources and 1 Java source to C:\dev\community\target\scala-2.10\classes... 

enter image description here

Unused import statementなしているためでありますクラスがそのパッケージで使用されています。この行は、インポートを最適化することで安全に削除できます。Ctrl + Alt + o

この場合、私はスカラーライブラリを全く追加しませんでした。私はコマンドラインからコンパイルしました。

+0

詳細な手順をありがとうございます。 cmd + alt + oは、使用されていないが実際に使用されていると仮定しているため、すべてのインポート文を削除しました。その後、私はアプリを実行するとき、私はエラーが見つかりません:型コントローラ ' –

+0

@ tylerdurdenだから私はあなたが同じエラーを持っていただろう方法に従って新しい空のプロジェクトを作成する?あなたは述べています*スカラーコンパイラとライブラリを外部ライブラリに追加してください*。その部分をスキップするとどうなりますか(問題ではありませんが)。 – maba

+0

スクラッチから作成、感謝の男! –

関連する問題