# Multi project build exception java.lang.NoClassDefFoundError while deploy via eclipse

**URL:** <https://discuss.gradle.org/t/multi-project-build-exception-java-lang-noclassdeffounderror-while-deploy-via-eclipse/6255>\
**Category:** Old Forum Archive\
**Created:** [February 14, 2014, 3:07pm UTC](https://discuss.gradle.org/t/multi-project-build-exception-java-lang-noclassdeffounderror-while-deploy-via-eclipse/6255 "2014-02-14T15:07:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![avalanche](https://avatars.discourse-cdn.com/v4/letter/a/ea5d25/32.png) [@avalanche](https://discuss.gradle.org/u/avalanche)\
**Post date:** [February 14, 2014, 3:07pm UTC](https://discuss.gradle.org/t/multi-project-build-exception-java-lang-noclassdeffounderror-while-deploy-via-eclipse/6255/1 "2014-02-14T15:07:00Z")

</div>

Hi All, I am new to gradle and I am trying to configure simple spring mcv project containing 3 projects: project-api, project-web, and project-test. This is my main build.grade:

```gradle
sourceCompatibility = 1.7
   subprojects {
    apply plugin: 'java'
 }

```

this is my settings.gradle

```gradle
rootProject.name = 'project'
include 'project-test'
include 'project-web'
include 'project-api'

```

This is my build.gradle from api

```gradle
apply plugin: 'java'
apply plugin: 'eclipse'
  repositories {
    mavenCentral()
}
  dependencies {
}

```

And this is part of my build.gradlew from web.

```gradle
dependencies {
 compile project(':project-api')

```

And issue is then when I try to deploy my app from eclipse I get following exception:

```gradle
nested exception is java.lang.NoClassDefFoundError: project/api/ImportantClass

```

In eclipse iteself everything looks ok I don’t have any errors. However if I buiild war using gradle and then deploy it manually to tomact I have no issues and jar project-api.jar is added to war and I am able to use my application. I guess this is related to gradle and eclipse perhaps I am missing something in my build.gradle? This is my OS info:

```gradle
------------------------------------------------------------
Gradle 1.10
------------------------------------------------------------
  Build time:
 2013-12-17 09:28:15 UTC
Build number: none
Revision:
   36ced393628875ff15575fa03d16c1349ffe8bb6
  Groovy:
     1.8.6
Ant:
        Apache Ant(TM) version 1.9.2 compiled on July 8 2013
Ivy:
        2.2.0
JVM:
        1.7.0_51 (Oracle Corporation 24.51-b03)
OS:
         Linux 3.11.0-13-generic amd64

```

Thanks in advance for any help.

---

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [February 14, 2014, 3:55pm UTC](https://discuss.gradle.org/t/multi-project-build-exception-java-lang-noclassdeffounderror-while-deploy-via-eclipse/6255/2 "2014-02-14T15:55:00Z")

</div>

Make sure to apply the ‘eclipse’ plugin to ‘allprojects’.

---

<div class="post-metadata">

**Author:** ![avalanche](https://avatars.discourse-cdn.com/v4/letter/a/ea5d25/32.png) [@avalanche](https://discuss.gradle.org/u/avalanche)\
**Post date:** [February 14, 2014, 4:36pm UTC](https://discuss.gradle.org/t/multi-project-build-exception-java-lang-noclassdeffounderror-while-deploy-via-eclipse/6255/3 "2014-02-14T16:36:00Z")

</div>

I added to my main build.gradle

```gradle
allprojects {
    apply plugin: 'eclipse'
}

```

Then run clean cleanEclipse eclipse and reimport project and still the same.

---

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [February 14, 2014, 5:14pm UTC](https://discuss.gradle.org/t/multi-project-build-exception-java-lang-noclassdeffounderror-while-deploy-via-eclipse/6255/4 "2014-02-14T17:14:00Z")

</div>

When you work in Eclipse, build/deploy happens entirely on the Eclipse side, so you’ll have to start looking there. First thing I’d check is whether the Eclipse projects have the correct class path with the correct (Eclipse) project dependencies.

---

<div class="post-metadata">

**Author:** ![avalanche](https://avatars.discourse-cdn.com/v4/letter/a/ea5d25/32.png) [@avalanche](https://discuss.gradle.org/u/avalanche)\
**Post date:** [February 15, 2014, 10:44am UTC](https://discuss.gradle.org/t/multi-project-build-exception-java-lang-noclassdeffounderror-while-deploy-via-eclipse/6255/5 "2014-02-15T10:44:00Z")

</div>

Ok thaks for help. Now when I am sure that this is not gradle issue I will try to look for solution on eclipse site. Best Regards
