# Removing dependencies from classpath

**URL:** <https://discuss.gradle.org/t/removing-dependencies-from-classpath/5134>\
**Category:** Old Forum Archive\
**Created:** [September 9, 2014, 10:44pm UTC](https://discuss.gradle.org/t/removing-dependencies-from-classpath/5134 "2014-09-09T22:44:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![phil\_swenson](https://avatars.discourse-cdn.com/v4/letter/p/f17d59/32.png) [@phil\_swenson](https://discuss.gradle.org/u/phil_swenson)\
**Post date:** [September 9, 2014, 10:44pm UTC](https://discuss.gradle.org/t/removing-dependencies-from-classpath/5134/1 "2014-09-09T22:44:00Z")

</div>

I am kind of hacking gradle to let me publish sql resources to artifactory. I am publishing sql scripts as jar files so I can declare the scripts as dependencies. (BTW I think there should be a gradle feature that allows publisihng/consuming non-java dependencies)

When I declare dependencies like this:

```gradle
testRuntime(group: 'com.softwareag.db.cdbs', name: 'mssql-analysis', version: 'latest.milestone')

```

this allows me to find the jar file on disk and unzip it for use.

However, I do not want these dependencies to be added to the classpath when running tests (windows classpath too long issues).

Is there a way I can apply a pattern to not put any dependency in the classpath for test execution and IDE generation that has ‘com.softwareag.db.cdbs’ in it?

thanks! phil

---

<div class="post-metadata">

**Author:** ![Schalk\_Cronje](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/schalk_cronje/32/6511_2.png) [@Schalk\_Cronje](https://discuss.gradle.org/u/Schalk_Cronje)\
**Post date:** [September 10, 2014, 7:00pm UTC](https://discuss.gradle.org/t/removing-dependencies-from-classpath/5134/2 "2014-09-10T19:00:00Z")

</div>

Have you tried something like

```gradle
configurations {
  forSql
}
  dependencies {
  forSql 'com.softwareag.db.cdbs:mssql-analysis:latest.milestone'
}

```

Now it will not appear on classpath when runnign tests, but you can still get hold of all of the files via ‘project.configurations.forSql.files’

---

<div class="post-metadata">

**Author:** ![phil\_swenson](https://avatars.discourse-cdn.com/v4/letter/p/f17d59/32.png) [@phil\_swenson](https://discuss.gradle.org/u/phil_swenson)\
**Post date:** [September 10, 2014, 7:09pm UTC](https://discuss.gradle.org/t/removing-dependencies-from-classpath/5134/3 "2014-09-10T19:09:00Z")

</div>

Lol… this is exactly what occurred to me about 5 mins ago!

Giving it a go right now, I’ll report my results.
