This script generates all the IML files, library descriptors, and the modules.xml file needed to have a complete Liferay project that successfully resolves imports in JSPs and Java files across the 1000+ modules in Liferay.
If you're more of a visual person and would like screenshots to better understand what that actually means, check the ABOUT file.
To setup the script, please use the following steps.
- Install NodeJS (tested with NodeJS 0.12.x, 4.x, 6.x, and 8.x), or use Node Version Manager to allow for multiple versions of NodeJS (needed if you need to work on legacy frontend code)
- Backup the
.ideafolder in your portal source in case you dislike the result (other than the.imlfiles it creates, the script writes its files here) - Clone this repository.
git clone [email protected]:holatuwol/liferay-intellij.git- Add a Bash function that makes it easy for you to call it and do any other setup. Replace
/path/to/clone/locationwith the path to theliferay-intellijfolder that you created by cloning the repository in step 3.
IJ_CLONE_PATH=/path/to/clone/location
ij() {
${IJ_CLONE_PATH}/intellij "$@"
}There are a few different ways to use this script, which are documented below. Once you've followed the instructions, have IntelliJ open the project rooted in the folder where you ran the ij function, and it will load your populated project!
To load a project containing only the portal source for a public repository, follow these instructions.
- Navigate to where you've cloned the liferay-portal repository
- Run the
ijcommand (no parameters) to generate the IntelliJ project
cd /path/to/portal/public/source
ijIf you'd like to work with master-private or 7.0.x-private and you need the history on the master and 7.0.x branches, follow these instructions.
- Navigate to where you've cloned the liferay-portal repository
- Run the
ijcommand, and specify the path to where you cloned the liferay-portal-ee repository and checked out the corresponding private branch
cd /path/to/portal/public/source
ij /path/to/portal/private/sourceIf you'd like to work with master-private or 7.0.x-private and you don't need the history on the master and 7.0.x branches, follow these instructions.
- Navigate to where you've cloned the liferay-portal-ee repository
- Run the
ijcommand (no parameters) to generate the IntelliJ project
cd /path/to/portal/private/source
ijTo load a project containing only the portal source for a public repository and the code for all public/private subrepositories that you've checked out, follow these instructions.
- Navigate to where you've cloned the liferay-portal repository
- Run the
ijcommand, and specify as an argument the path to where you cloned the various subrepositories. If you have them all cloned inside of one parent folder, just specify the one parent folder and it will locate them all!
cd /path/to/portal/public/source
ij /path/to/subrepo1 /path/to/subrepo2 /path/to/subrepo3cd /path/to/portal/public/source
ij /path/to/subreposTo load a project containing only the portal source for a public repository and the code for all public/private subrepositories that you've checked out, follow these instructions.
- Navigate to where you've cloned the liferay-portal repository
- Run the
ijcommand, and specify as an argument the path to where you cloned the liferay-portal-ee repository and checked out the corresponding private branch, and specify the various subrepositories. If you have them all cloned inside of one parent folder, just specify the one parent folder and it will locate them all!
cd /path/to/portal/public/source
ij /path/to/portal/private/source /path/to/subrepo1 /path/to/subrepo2 /path/to/subrepo3cd /path/to/portal/public/source
ij /path/to/portal/private/source /path/to/subrepos/parentThere are a few features for atypical scenarios as well.
There are a few command-line flags that you can pass to ij in order tell it to do some extra processing.
--barebone: unload modules that aren't required by portal-impl to improve IntelliJ startup speed (must manually reload any module you actually use)--no-complete-cache: do not download any missing dependencies not present in your local Maven and Gradle caches--mvn-cache: when downloading missing dependencies, prefer downloading to the global Maven cache rather than the local project Gradle cache--ic: do not add any web facets, so that the project is compatible with IntelliJ community edition--unload: unload modules that aren't built as part ofant allto improve IntelliJ startup speed--unzip: unzip existing.jarfiles from a Liferay Tomcat bundle into the build folders of your project
All folders that you specify as arguments will be assumed either to be an Ant-based Plugins SDK root (designated by the presence of build-common-plugins.xml), a Blade workspace (designated by the presence of a gradle.properties), or a folder used to store subrepositories (such as those generated by forking subrepositories OR the modules folder of the master-private and 7.0.x-private branch).
ij /path/to/folder1 /path/to/folder2 /path/to/folder3The script generates .iml files that are slightly different from the ones that have been committed to Liferay's version control, so the alias adds all .iml files to an ignore list. You can clear your ignore list with the following.
git ls-files -v | grep '^h ' | cut -d' ' -f 2 | xargs git update-index --no-assume-unchanged