Creating projects outside the IDE

Hello everyone.

Our company needs to create IDEA projects from a different executable (outside of the IDE). We have a build system that, with the appropriate command, checks out code and optionally creates debugging environments for various IDEs.

I've spent a day looking through and experimenting with the Open API to no avail. Help! :)

The closest I've come to is Priya's post regarding "creating projects programatically". Going by sheer guesswork, the code I've played with is: ProjectManager->getInstance() -> getDefaultProject() -> getModifiableModel() -> newModule(name). This fails immediately with a null exception trying to get the default project.

I would appreciate any help I can get lest I fall back to programatically reverse engineering the *.i?? XML files themselves, which would be fragile with regards to IDEA versioning.

Thanks in advance!

Mike
BondDesk Group

4 comments
Comment actions Permalink

There is no way to use anything of the OpenAPI from outside IDEA. However there is a command-line API that you could possibly use to invoke a plugin that can create a project. Have a look at com.intellij.openapi.application.ApplicationStarter and com.intellij.openapi.diff.DiffApplication about how this API works.

Sascha

0
Comment actions Permalink

I've looked through the Open API dev kit and have only found html and class files for the DiffApplication. Can anyone tell me where the source is?

A D:\build\idea\help\openapi\com\intellij\openapi\diff\class-use\DiffApplication.html
A D:\build\idea\help\openapi\com\intellij\openapi\diff\DiffApplication.html
A D:\build\idea\redist\com\intellij\openapi\diff\DiffApplication.class

Mike

0
Comment actions Permalink

The source is in lib\src\src_openapi.zip, to answer my own question.

APIs, black boxes, hierarchies, libraries...the first few steps are always the most painful. :)

0
Comment actions Permalink

Information for developers: I now have preliminary code to create projects from the command line. As Sascha recommended, this is done by using the ApplicationStarter extension. The code to actually create the project is based on Priya's post "creating projects programatically."

Lessons learned along the way:

- You may need to look at the source files (in lib\src\src_openapi.zip) since the Open API's documentation may not be sufficient.
- Include idea.jar in the plug-in to get ProjectManagerEx, etc.
- Do not let the plugin.dtd bother you: it throws up spurious warnings.

Mike

0

Please sign in to leave a comment.