Reputation: 11008
After I create a new Play app
$ play new myapp
$ cd myapp/
$ play idealize
$ ls
app conf lib myapp.iml public test
I can open a file (only if an IDEA project is already opened) using
$ alias "ij=open -a /Applications/IntelliJ\ IDEA*.app"
$ ij app/controllers/Application.java
Is there a nice way to create a new (or open an existing) Play project from the command line? I could write a simple script which creates the necessary XML-files (myapp.ipr, myapp.iws) and then opens the project by
$ ij myapp.ipr
but I hope this is unnecessary (or has been already done).
Upvotes: 4
Views: 1753
Reputation: 11008
I have forked the framework and made the necessary changes to make this possible. See https://github.com/andreif/play/commit/ec70ab8162620a0c9ba5ca7195fc3c51d7de91b1 (note, the branch is called idea_project!)
This commit adds command ideaproj
which creates Module, Project and Workspace files of a very simple structure. If you are using OS X, the command will also try to open the project in all(!) IDEA apps located at /Applications/IntelliJ\ IDEA*.app
. So adjust the python script in case if you have more than one IDEA app there. Additionally, you will probably want to change the default workspace layout. Have a look at iwsTemplate.xml
and modify it to fit your preferences.
Usage: run the following command in the app directory to create IDEA project files (and open them):
play ideaproj
Note, that it will overwrite existing project files! If the IDEA project is already opened at the time you run this command again, then IDEA will ask you if you want to reload the project.
I have also added the following two commits:
If you want to start using this command now, then copy files intellij.py
, iprTemplate.xml
, and iwsTemplate.xml
to your Play framework directory (to the corresponding locations!).
EDIT: I have made two more commits to fix project tree in the workspace template, so that it expands first time you open the project.
Upvotes: 0
Reputation: 16439
If you can create the project files as you mention, idealize generates an Idea Module file for the Play project, so it should be as simple as to integrate that Module in your project file and open the project.
If you do that, please publish it as a Module in Play, it would be handy :)
Upvotes: 1