How to reference classpath from Gradle 0.6

I have a project using Gradle as a build tool, and I have to use the Ant Java task . One of the sub-elements in this task is a reference to the classpath, and I would like to use refid. The build script uses the Gradle WAR plugin . Since the compilation task works without any problems, I know that the class path is configured correctly:

  dependencies {
   compile 'commons-beanutils: commons-beanutils: 1.8.0'
   compile group: 'commons-lang', name: 'commons-lang', version: '2.4'
   ...
 }

No. I would like to refer to this classpath in my Gradle build script.

I tried the following:

Using classpathId (built-in?) I searched the Gradle mailing lists and found a suggestion:

project.dependencies.antpath('compile')

This results in an error. Also tried several options for this, but so far no luck. Any suggestions are welcome.

+4
source share
1 answer

The following settings are listed:

  configurations.compile.asPath

If you have defined your own configuration, you can also use it:

  configurations {
     gwtCompile
 }
 ....
 ant.java (classname: 'com.google.gwt.dev.Compiler', fork: 'true', failOnError: 'true') {
     jvmarg (value: '-Xmx184M')
     arg (line: '-war' + gwtBuildDir)
     arg (value: 'com.yoobits.ocs.WebApp')
     classpath {
         pathElement (location: srcRootName + '/' + srcDirNames [0])
         pathElement (path: configurations.compile.asPath)
         pathElement (path: configurations.gwtCompile.asPath)
     }
 }

In the above example, I got access to the compilation path and to my own configuration, which is interesting only during the special phase during compilation of the assembly using the GWT compiler.

+10
source

Source: https://habr.com/ru/post/1286135/


All Articles