IntelliJ IDEA
Play提供了一个简化IntelliJ IDEA配置的命令。要将现有应用程序转换为有效的IntelliJ IDEA模块,请使用以下idealize命令:
play idealize myApp
要创建单个模块项目,请在IntelliJ IDEA中执行以下操作。
在命令行上,使用play new命令创建Play项目。
在命令行上,使用该play idealize命令创建IntelliJ IDEA模块。
在IntelliJ IDEA中,在“ 文件”菜单上,选择“ 打开项目…”,然后选择生成的.ipr文件。
要添加运行配置:
在IntelliJ IDEA中的“运行”菜单上,选择“ 编辑配置”。
右键单击Defaults下的Application,然后选择Add New Configuration。
在Main类下,输入play.server.Server。
在VM参数下,输入-Dapplication.path="."。
在“ 工作目录”下,输入应用程序路径。
在启动之前,删除Makeif exists。
要在IntelliJ中以测试模式运行Play:
编辑运行配置并在VM参数中添加-Dplay.id= test。
右键单击模块,然后选择“ 打开模块设置”。
选择“ 依赖关系”选项卡。
单击添加…,然后选择单条目模块库。
选择$PLAY_HOME/modules/testrunner/lib/play-testrunner.jar并单击“ 确定”。
在团队中工作时不要提交.iml文件!
生成的配置文件包含对框架安装的绝对引用。这些特定于您自己的安装。当您在同一个应用程序的团队中工作时,每个开发人员都必须将其IntelliJ IDEA配置文件保密。
各个IDE的配置
Play provides a command to simplify IntelliJ IDEA configuration. To transform an existing application to a valid IntelliJ IDEA module, use the idealize command:
play idealize myApp
To create a single module project, do the following in IntelliJ IDEA.
On the command line, use the play new command to create the Play project.
On the command line, use the play idealize command to create an IntelliJ IDEA module.
In IntelliJ IDEA, on the File menu, select Open Project… and select the generated .ipr file.
To add a run configuration:
In IntelliJ IDEA, on the Run menu, select Edit Configurations.
Right-click on Application under Defaults and select Add New Configuration.
Under Main class, enter play.server.Server.
Under VM parameters, enter -Dapplication.path=".".
Under Working directory, enter the application path.
Under Before launch, remove Make if exists.
To run Play in test mode in IntelliJ:
Edit the run configuration and in VM parameters, append -Dplay.id=test.
Right-click on your module and select Open Module Settings.
Select the Dependencies tab.
Click Add… and select Single-Entry Module Library.
Select $PLAY_HOME/modules/testrunner/lib/play-testrunner.jar and click OK.
Do not commit the .iml files when you work in a team!
The generated configuration files contains absolute references to your framework installation. These are specific to your own installation. When you work in a team on the same application, each developer must keep his IntelliJ IDEA configuration files private.