How to exclude a folder from installDist?

I have included a folder with jars, that I need for compiling/testing:

dependencies {

compile fileTree(dir: ‘\myLibs’, include: ‘*.jar’) }

But when I run “installdist” I want to exclude this folder. How do I do that? (I am completely new to Gradle…)

Any suggestion?

1 Like

Hi Luis,

could you give me an idea why you want to do this?

Perryn

We are developing an application in Java that requires the libraries (*.jar) from a commercial application to compile & run. So on our development machines it is a compile & test dependency. We can not ship these libraries to the client though…the client will have the application installed on his machine and we will set the javapath correctly for him to run our application using the libraries already installed on his system.

Of course I can manually delete the list of libraries everytime we do a installDist, but I was hoping there would be a more automatic way in Gradle.

Thanks for your help!

Luis

Hi Luis

First define yourself a new configuration to describe the ‘platform’ your app requires to be installed.

configurations {
     platform {description = 'libraries provided by 3rd party application'}
}

Now, tell gradle what libraries are provided by the platform

dependencies {
     platform fileTree(dir: '\myLibs', include: '*.jar')
 }

Lastly tell gradle that it needs the platform dependencies on the classpath to compile the main source

sourceSets {
     main {
           compileClasspath += configurations.platform
     }
}

because these libraries are not part of the ‘compile’ configuration they should not longer be included in the distribution.

1 Like

Yes, that worked!

Thanks a lot for your help,

Saludos,

Luis