Using IntelliJ IDEA to develop Lift applications

来源:互联网 发布:轻薄笔记本 知乎 编辑:程序博客网 时间:2024/05/01 22:35

Using IntelliJ IDEA to develop Lift applications

At the moment (in absence of a proper Lift plug-in for IntelliJ), you can use IntelliJ as a code completion/syntax checking/import managing tool.You will need Maven, SBT and the Scala plug-in for IntelliJ. IntelliJ will manage your dependencies using the POM, you will build and run with SBT. Get all three, then proceed as follows.

Steps

  1. Use one of the Maven archetypes referenced elsewhere on this wiki to create a Lift project. The pom.xml will be used by IntelliJ to import your dependencies
  2. Create an SBT project on top of the Maven project (enter the project directory and run SBT)       Go to the Maven project, for example: lift_test/. Then run sbt. After that, run reload and update. Then run jetty-run command and you can view the page fromhttp://localhost:8080.                                   
  3. Create a new IntelliJ project from what results, using Import Project from External Model => Maven
  4. Add a Scala aspect to the project, employing Use Files. Point the plug-in to the project/boot subdirectory where SBT downloaded your Scala
  5. Develop with pleasure 
  6. Run your project.

 Click Maven Project on the right of IDEA, clikc lift_test(your project name), click jetty and then click jetty.run to run your project.

Gotchas

  • The Scala plug-in does not treat implicits as dependencies yet. If you’re importing implicits into a page (e.g., DSLs, e.g., the LIft JSON DSL), the dependency will be grayed out as if unused. It’s not. Don’t remove it, or optimize imports on that file – you will get cryptic compilation errors

Comments

  1. The Scala plugin in only being actively developed for the version 10 (X) release of IDEA which is currently in “Early Access Program” (pre-release). If you have questions about stability or usability of specific versions, please feel free to ask in the Google group/mailing list.
  2. It is perfectly acceptable to use Ant for developing in Lift. If your organization’s management does not buy off on switching to SBT or Maven and you need assistance setting up an Ant build, please direct your questions to the Google group/mailing list.
  3. To enable full syntax checking in the Scala plugin: 
    Mac: Command + alt/option + shift + e
    Windows: alt + control + shift + e
原创粉丝点击