In the previous post of this series my colleague Maria show you how to setup GeoNetwork 3 in Eclipse IDE. If you’re a user of IntelliJ IDE, start working with GeoNetwork is really easy.
You only need to checkout GeoNetwork from GitHub:
$ git clone https://github.com/geonetwork/core-geonetwork.git gn-develop
$ cd gn-develop
$ git submodule update ––init
In IntelliJ select the GeoNetwork folder with File > Open:
Wait a moment so IntelliJ imports the project maven modules and congratulations, you have GeoNetwork working in IntelliJ!
Lets check now how to debug GeoNetwork inside IntelliJ. There’re several ways, but I’m going to explain the one that works better for me.
Add a new Configuration of type Remote and set the name to Jetty:
So lets start debugging, in a terminal window lets run GeoNetwork in maven embedded jetty. First add the debug options from the previous dialog to MAVEN_OPTS and startup GeoNetwork:
$ export MAVEN_OPTS='-Xmx1024M -XX:MaxPermSize=512M -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005'
Lets build GeoNetwork (if you didn’t build it already):
$ cd gn-develop
$ mvn clean install –DskipTests
After this you can run GeoNetwork in embedded Jetty:
$ cd web
$ mvn jetty:run
In IntelliJ, attach IntelliJ debug to the Jetty process:
A similar approach can be used to deploy GeoNetwork in Tomcat, add to CATALINA_OPTS the debug options and attach IntelliJ debug to the Tomcat process.
IntelliJ (https://www.jetbrains.com/idea/) is not open source, but JetBrains supports nicely open source projects, providing free licenses to developers of open source projects. I can’t be more graceful about this.