# Unable to resolve class ... in build.gradle script

**URL:** <https://discuss.gradle.org/t/unable-to-resolve-class-in-build-gradle-script/3616>\
**Category:** Old Forum Archive\
**Created:** [July 3, 2013, 9:07am UTC](https://discuss.gradle.org/t/unable-to-resolve-class-in-build-gradle-script/3616 "2013-07-03T09:07:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![u1234](https://avatars.discourse-cdn.com/v4/letter/u/2acd7d/32.png) [@u1234](https://discuss.gradle.org/u/u1234)\
**Post date:** [July 3, 2013, 9:07am UTC](https://discuss.gradle.org/t/unable-to-resolve-class-in-build-gradle-script/3616/1 "2013-07-03T09:07:00Z")

</div>

I have a gradle multi project with a subproject A. In the subproject A I have a build.gradle file with the following task:

```gradle
import com.samples.*;
  apply plugin: 'java'
apply plugin: 'maven'
  sourceSets {
 main {
  java {
   srcDir 'src'
  }
 }
}
  task myTask(dependsOn: "classes") << {
  MyClass m = new MyClass();
}

```

Where com.samples.MyClass is located in the source folder ‘src’. When I build this project with gradle clean install I get:

```gradle
build file '....\build.gradle': 21: unable to resolve class MyClass
  @ line 21, column 15.
     MyClass m = new MyClass();

```

Why is MyClass not visible in the build script?

---

<div class="post-metadata">

**Author:** ![luke\_daley](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/luke_daley/32/9890_2.png) [@luke\_daley](https://discuss.gradle.org/u/luke_daley)\
**Post date:** [July 3, 2013, 9:15am UTC](https://discuss.gradle.org/t/unable-to-resolve-class-in-build-gradle-script/3616/2 "2013-07-03T09:15:00Z")

</div>

The classes used by the build are entirely separate from the classes being built by the build. Groovy is a compiled language, which means the classes are needed before the script starts executing.

What are you trying to do?
