# Multiple class directories for jettyRun

**URL:** <https://discuss.gradle.org/t/multiple-class-directories-for-jettyrun/9816>\
**Category:** Help/Discuss\
**Created:** [May 26, 2015, 7:43pm UTC](https://discuss.gradle.org/t/multiple-class-directories-for-jettyrun/9816 "2015-05-26T19:43:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![karolkawaii](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/karolkawaii/32/2410_2.png) [@karolkawaii](https://discuss.gradle.org/u/karolkawaii)\
**Post date:** [May 26, 2015, 7:43pm UTC](https://discuss.gradle.org/t/multiple-class-directories-for-jettyrun/9816/1 "2015-05-26T19:43:38Z")

</div>

Hello, I’m an intern (so, I’m newbie 😊 ) and I suggested to my boss the implementation of Gradle as build tool. As the project has been underway for months have restrictions to change the layout of directories.  
In the project there is a web part (interface) and the layers with java code (domain, process and persistence). The layout of my project is as follows:

suite  
–src  
-----domain  
-----interface  
-----persistence  
-----process  
–libs  
–build.gradle

I compile my project, but when I open my web application on localhost:8080/interface.Looks like the web application could not see my java directories. I searched and found that we can set the classes directory through jettyRun.classesDirectory, but he does not accept a list of directories. How to proceed?  
There is my build.gradle

```
apply plugin: "java"
apply plugin: "war"
apply plugin: "jetty"
compileJava.options.encoding = "UTF-8"
repositories {
    mavenCentral()
}
jettyRun.webAppSourceDirectory = file("src/interface/")
project.webAppDirName = file("src/interface/")

jettyRun {
    setClassPathFiles {
        srcDirs (
            "src/domain/src/",
            "src/persistence/src/",
            "src/process/src/"
        )
    }
}
sourceSets {
    main {
        java {
            srcDirs (
                "src/domain/src/",
                "src/persistence/src/",
                "src/process/src/"
            )
        }
        resources {
            srcDir "libs/"
        }
    }
}
dependencies {
    compile (
       //a lot files
        )
    )
}

```

Already grateful and sorry about my english. It isn’t my native language.

---

<div class="post-metadata">

**Author:** ![mark\_vieira](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/mark_vieira/32/5396_2.png) [@mark\_vieira](https://discuss.gradle.org/u/mark_vieira)\
**Post date:** [May 26, 2015, 8:52pm UTC](https://discuss.gradle.org/t/multiple-class-directories-for-jettyrun/9816/2 "2015-05-26T20:52:35Z")

</div>

Configuring the jettyRun task shouldn’t be necessary. You are already telling Gradle where your code lives by configuring the source sets. Is your code being properly compiled? You should see the class files in the ‘build/classes/main’ directory.

> [@karolkawaii](#):
>
> Looks like the web application could not see my java directories.

Not sure exactly what you mean by this. Are you getting a `ClassNotFoundException`?

---

<div class="post-metadata">

**Author:** ![mark\_vieira](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/mark_vieira/32/5396_2.png) [@mark\_vieira](https://discuss.gradle.org/u/mark_vieira)\
**Post date:** [May 26, 2015, 10:44pm UTC](https://discuss.gradle.org/t/multiple-class-directories-for-jettyrun/9816/3 "2015-05-26T22:44:02Z")

</div>

You may also want to consider using the superior [Gretty](https://github.com/akhikhl/gretty) plugin. The core jetty plugin is likely to be deprecated in the future.

---

<div class="post-metadata">

**Author:** ![karolkawaii](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/karolkawaii/32/2410_2.png) [@karolkawaii](https://discuss.gradle.org/u/karolkawaii)\
**Post date:** [May 27, 2015, 2:27am UTC](https://discuss.gradle.org/t/multiple-class-directories-for-jettyrun/9816/4 "2015-05-27T02:27:36Z")

</div>

I’ll try Gretty. Thank you, Mark. 😉
