Phyxx
Phyxx

Reputation: 16085

Can I use Gradle to build a classpath string

I need to execute an external Java application as part of a Gradle build process. The external application needs the same JARs in its classpath as the application Gradle is building. Is there any way to expose the dependencies I have defined in Gradle to the external application?

i.e. I need to run this:

java -jar -cp [jars from Gradle] myapp.jar

Upvotes: 0

Views: 876

Answers (1)

Mark Vieira
Mark Vieira

Reputation: 13466

You could add a simple task to your build to get the resulting classpath.

task printClasspath << {
    println configurations.runtime.asPath
}

Upvotes: 2

Related Questions