Do you want to develop Nuxeo Platform with you favorite IDE IntelliJ?
I’d like to share with you the IntelliJ configuration for Nuxeo. After reading this, you’ll understand how to:
- Getting the Nuxeo Source Code
- Import Nuxeo Source Code into IntelliJ
- Configure Nuxeo Code Style
- Compiling and Building Nuxeo Server with IntelliJ
- Installing Web UI bundle to Nuxeo Server
Before getting started, you need to ensure your computer has installed the following software:
- IntelliJ IDEA CE (Latest)
- JDK 8 (Oracle's JDK or OpenJDK recommended)
- Apache Maven 3.1.1+ (3.2+ recommended)
- Apache Ant 1.7.1+
- Git
- NodeJS 0.10.32 and (npm, yo, grunt, grunt-cli, gulp, bower) don't forget to install these are very important
- Python 2.7
Clone the Nuxeo 'master' branch to some folder using git GUI or Command line
https://github.com/nuxeo/nuxeo.git
In the cloned source code folder find 'clone.py' and execute following command
python clone.py master -a
-Xmx4g -Xms1g
Now import Nuxeo source code as Maven project. In the default welcome menu, choose Import Project, then find the Nuxeo root folder and select the POM file in $NX_HOME/pom.xml. Afterwards, set up the Maven import options as the following screenshot:
Later, you will need to:
- Choose Maven profiles: default
- Choose Project SDK: use JDK 8 (in next steps)
- Edit name to create a new IntelliJ project: default (or anything you like) (in next steps)
When the configuration is finished. IntelliJ will create a project for you, the entire process (Maven import) will take a some minutes, You have to be patient about that. And final view will be something like this:
Get the Eclipse code formatter plugin (https://plugins.jetbrains.com/plugin/6546-eclipse-code-formatter) from Preferences > Plugins > Install JetBrains Plugin > Search "Eclipse code formatter" and install it. It will improve the performance of IntelliJ. You can customize the VM options by Click Help > Edit Custom VM Options…. If there’s no existing configuration file, IntelliJ will help you to create one. Then edit the content with your preferred values:
-Xmx4g -Xms1g
To compile and run nuxeo project you need to create a configration. In my case of Mac OS you can use (https://plugins.jetbrains.com/plugin/4230-bashsupport) and in case of Windows you can use (https://plugins.jetbrains.com/plugin/265-batch-scripts-support). You can install the required plugin from Preferences > Plugins > Install JetBrains Plugin > Search plugin name .
You can create a run.sh/run.bat (bash or batch script) in $NX_HOME/Scripts and add following command to it.
For Mac OS
/YOUR_PATH_TO_NUXEO/nuxeo/nuxeo-distribution/nuxeo-server-tomcat/target/nuxeo-server-tomcat-9.2-SNAPSHOT/bin/Start\ Nuxeo.command
For Windows
"C:\YOUR_PATH_TO_NUXEO\nuxeo\nuxeo-distribution\nuxeo-server-tomcat\target\nuxeo-server-tomcat-9.2-SNAPSHOT\bin\Start Nuxeo.bat"
After that you have to create a run configuration which should look like this:
In before launch section you need to add "Make" (Which will compile all the sources) and also create a "Run Maven Goal" with following parameters:
clean -DskipTests=true install -Paddons,distrib
*Most common mistake is either not having right Maven (I am using 3.3.9) version installed or not having all required NPM components (npm, yo, grunt, grunt-cli, gulp, bower) or missing any other prerequisites
and run the project after making configrations and if everything goes well you should see the Nuxeo Server GUI:
if you go to browser and open following link you should see that nuxeo server is up and running.
http://localhost:8080/nuxeo
!!! IMPORTANT !!! Before installing component you need to stop the Nuxeo Server!
Nuxeo Web UI component can be downloaded from following link https://connect.nuxeo.com/nuxeo/site/marketplace/package/nuxeo-web-ui Now using following command install Nuxeo Web UI Comoponent
/YOUR_PATH_TO_NUXEO/nuxeo/nuxeo-distribution/nuxeo-server-tomcat/target/nuxeo-server-tomcat-9.2-SNAPSHOT/bin/nuxeoctl mp-install <download-path>/nuxeo-web-ui-0.10.0.zip
If while installing the component it askes you to "Do you want to relax the constraint (yes/no)?" Answer with Yes
Now start the server using following command or run your 'run.bat/run.sh' script.
For Mac OS
/YOUR_PATH_TO_NUXEO/nuxeo/nuxeo-distribution/nuxeo-server-tomcat/target/nuxeo-server-tomcat-9.2-SNAPSHOT/bin/Start\ Nuxeo.command
For Windows
"C:\YOUR_PATH_TO_NUXEO\nuxeo\nuxeo-distribution\nuxeo-server-tomcat\target\nuxeo-server-tomcat-9.2-SNAPSHOT\bin\Start Nuxeo.bat"
and if everything works fine you should see fully functional nuxeo server with a UI interface on http://localhost:8080/nuxeo. You can login to the dashboard using following credentials.
Username: Administrator Password: Administrator