Gradle multi project under eclipse, classnotfound exception, need your help


(Dor Ben Dov) #1

Hi,

Will appreciate your answer, pretty stuck here. I have this multi project structure, created using the gradle eclipse plugin.

project: itest --> For integration tests project: model --> Model objects project: service-ifc --> Service interfaces project: service-impl --> Service implementation project: web --> Web project in which i am running under tomcat project: parent --> The multi project

All projects located under parent, parent have build.gralde and settings.gradle. It’s settings gradle does include for all other projects. Project service-impl needs service-ifc and model, so i wrote inside it’s build.gradle under dependencies : compile project (’:model’), project (’:service-ifc’)

Project web needs service-impl, so i wrote inside it’s build.gradle under dependencies : compile project (’:service-impl’)

*Let’s say for start i have one service class and one service interface class.

When i am running the web project in my tomcat (inside eclipse) i am receiving class not found exception that my service interface isn’t found.

If you look inside the web.war you will see that under lib folder you have service-impl,service-ifc and model project jars.

What’s wrong , what’s is my mistake , what i am missing here ?

Tried also to add this to the build.gradle dependencies of the parent project project(’:service-impl’){

dependencies{

compile project(’:model’), project(’:service-ifc’) }

Still the same issue.

Thanks in advance to you all,

Dor


(Radim Kubacki) #2

Your approach seems correct yet you claim that it is not working. There are too many missing parts in your description for me to guess. In such case I’d start with building the project using Gradle and deploying it to Tomcat. Once you are sure that this is working and the structure of your build and its dependencies is correct we can proceed to the next step.

I need to admit that I do not know what does it mean to run Tomcat inside Eclipse. I’d look for Tomcat logs to see if there is anything interesting.


(Dor Ben Dov) #3

After building the WAR file ., i deployed it on an external tomcat not the one you can use as embedded inside eclipse.

It works.

Which means that it is eclipse or eclipse plugins with gradle to blame.

Dor


(Radim Kubacki) #4

Do you create your eclipse project using ‘eclipse’ or ‘eclipse-wtp’ plugin? Or do you use project import in Eclipse with or without WTP support on?


(Dor Ben Dov) #5

I am using

apply plugin: ‘eclipse’ apply plugin: ‘eclipse-wtp’