[GeoNetwork-devel] eclipse setup query

Hi all,
till now I was happy with editing sources in eclipse and actually running it outside using Jetty, since I was able to run from the source without deploying.

But now I need to debug java code. If I right click on geonetwork-main, I don’t get the option “Run on Server…” as with any dynamic web project in eclipse.

It looks I need to add ‘Dynamic Web Module’ option in Properties → Project facets, to be able to run geonetwork-main on tomcat. But following error is preventing it to be added:

Cannot nest ‘geonetwork-main/src/main/webapp/WEB-INF/classes/setup/sql/migrate’ inside library ‘geonetwork-main/src/main/webapp/WEB-INF/classes’

This may be eclispe bug (https://bugs.eclipse.org/bugs/show_bug.cgi?id=127994) but if any of you debugs java code in eclipse, then you must have solved this bug too… any help?

Thanks n Regards

Ameet

On Fri, Apr 25, 2014 at 7:30 AM, Ameet Chaudhari
<ameet.chaudhari@anonymised.com>wrote:

Hi all,
till now I was happy with editing sources in eclipse and actually running
it outside using Jetty, since I was able to run from the source without
deploying.

But now I need to debug java code. If I right click on geonetwork-main, I
don't get the option "Run on Server..." as with any dynamic web project in
eclipse.

It looks I need to add 'Dynamic Web Module' option in Properties ->
Project facets, to be able to run geonetwork-main on tomcat. But following
error is preventing it to be added:

*Cannot nest
'geonetwork-main/src/main/webapp/WEB-INF/classes/setup/sql/migrate' inside
library 'geonetwork-main/src/main/webapp/WEB-INF/classes'*

This may be eclispe bug (
https://bugs.eclipse.org/bugs/show_bug.cgi?id=127994) but if any of you
debugs java code in eclipse, then you must have solved this bug too.. any
help?

Thanks n Regards
Ameet

Hi,

What a coincidence! Yesterday I posted another mail about how to do this.
It's very easy:

* Move the webapp/classes folder to another location outside the project
* Right click on the project to run "Maven -> Update Project"
* Restore the webapp/classes folder

Sometimes it still shows some errors when adding again the webapp/classes
folder, but they don't break the build or the run. If you need to update
maven project again (when adding new dependencies, for example), you will
have to do the same steps again.

Regards,
María.

Hi,

The other solution provided to debug java with jetty:run :

···

On Fri, Apr 25, 2014 at 8:06 AM, María Arias de Reyna <delawen@anonymised.com> wrote:


Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform


GeoNetwork-devel mailing list
GeoNetwork-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-devel
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork


Florent Gravin
Camptocamp - Chambéry
0479444492

On Fri, Apr 25, 2014 at 7:30 AM, Ameet Chaudhari <ameet.chaudhari@anonymised.com> wrote:

Hi all,
till now I was happy with editing sources in eclipse and actually running it outside using Jetty, since I was able to run from the source without deploying.

But now I need to debug java code. If I right click on geonetwork-main, I don’t get the option “Run on Server…” as with any dynamic web project in eclipse.

It looks I need to add ‘Dynamic Web Module’ option in Properties → Project facets, to be able to run geonetwork-main on tomcat. But following error is preventing it to be added:

Cannot nest ‘geonetwork-main/src/main/webapp/WEB-INF/classes/setup/sql/migrate’ inside library ‘geonetwork-main/src/main/webapp/WEB-INF/classes’

This may be eclispe bug (https://bugs.eclipse.org/bugs/show_bug.cgi?id=127994) but if any of you debugs java code in eclipse, then you must have solved this bug too… any help?

Thanks n Regards

Ameet

Hi,

What a coincidence! Yesterday I posted another mail about how to do this. It’s very easy:

  • Move the webapp/classes folder to another location outside the project
  • Right click on the project to run “Maven → Update Project”
  • Restore the webapp/classes folder

Sometimes it still shows some errors when adding again the webapp/classes folder, but they don’t break the build or the run. If you need to update maven project again (when adding new dependencies, for example), you will have to do the same steps again.

Regards,
María.

Hey thanks to both of you, incidentally I came up with third solution by the time I saw your messages. That was to just comment out the following code in pom.xml and then import in eclipse:

org.codehaus.mojo




add-source


${basedir}/src/main/webapp/WEB-INF/classes/setup/sql/migrate ...

With this, I could run geonetwork-main in Tomcat in Eclipse without manually adding dynamic web module facet. But then another issue came since I was redirecting to widgets tab UI. Tomcat could not find /geonetwork/apps/tabsearch… I copied the apps folder in web-client to web module and it finally worked!

This solution does not impress as everytime I’ll have to update client files back in their correct location and remove copied apps folder, once debugging session is done. But at least now I can debug java code. :slight_smile:

I’ll try solutions given by both of you this weekend, the one by Florent Gravin seems to eliminate the need for any modification/restoration etc…

Have a nice day…

Ameet

···

On Fri, Apr 25, 2014 at 1:05 PM, Florent Gravin <florent.gravin@anonymised.com> wrote:

Hi,

The other solution provided to debug java with jetty:run :

You could run
export MAVEN_OPTS=“-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005”
before you run jetty:run.
This will put debug port of your maven on 5005.
Then in eclipse, go in debug configuration, add a new “remote java application”, and specify the port 5005


Systems Programmer
kCube Consultancy Services

On Fri, Apr 25, 2014 at 8:06 AM, María Arias de Reyna <delawen@anonymised.com> wrote:


Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform


GeoNetwork-devel mailing list
GeoNetwork-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-devel
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork


Florent Gravin
Camptocamp - Chambéry
0479444492

On Fri, Apr 25, 2014 at 7:30 AM, Ameet Chaudhari <ameet.chaudhari@anonymised.com> wrote:

Hi all,
till now I was happy with editing sources in eclipse and actually running it outside using Jetty, since I was able to run from the source without deploying.

But now I need to debug java code. If I right click on geonetwork-main, I don’t get the option “Run on Server…” as with any dynamic web project in eclipse.

It looks I need to add ‘Dynamic Web Module’ option in Properties → Project facets, to be able to run geonetwork-main on tomcat. But following error is preventing it to be added:

Cannot nest ‘geonetwork-main/src/main/webapp/WEB-INF/classes/setup/sql/migrate’ inside library ‘geonetwork-main/src/main/webapp/WEB-INF/classes’

This may be eclispe bug (https://bugs.eclipse.org/bugs/show_bug.cgi?id=127994) but if any of you debugs java code in eclipse, then you must have solved this bug too… any help?

Thanks n Regards

Ameet

Hi,

What a coincidence! Yesterday I posted another mail about how to do this. It’s very easy:

  • Move the webapp/classes folder to another location outside the project
  • Right click on the project to run “Maven → Update Project”
  • Restore the webapp/classes folder

Sometimes it still shows some errors when adding again the webapp/classes folder, but they don’t break the build or the run. If you need to update maven project again (when adding new dependencies, for example), you will have to do the same steps again.

Regards,
María.