« Return to Thread: gradle classpath to stdout

Re: gradle classpath to stdout

by hdockter :: Rate this Message:

Reply to Author | View in Thread

Apologies for answering so late.

On Jun 11, 2009, at 3:03 PM, David wrote:

> I'm working on converting a mode for emacs that parses maven poms,  
> called "pom-parser".  The mode takes advantage of the  
> "dependency:build-classpath" plugin, it parses the output and caches  
> a classpath.
>
> I'd like to do something very similar for gradle, but I haven't seen  
> how I can do this.   I tried using "gradle --dependencies" but that  
> only lists the dependencies.  I  could try to re-construct the  
> classpath by guessing where the dependencies are, but some of the  
> dependencies are added using "flatDir".  It doesn't looke like I can  
> tell where they are on the filesystem from the output of --
> dependencies.
>
>
> I tried also to run gradle with '--embedded':
>   gradle -e 'println "dependencies"' -r
>
> I think the '--embedded' option is the most promising path, but I'm  
> having trouble coming up with something that will work.  I've seen  
> references to 'configurations.myConfig.asPath' and  
> 'dependencies.antpath("compile") 'on the mailing list, those look  
> promising but I they don't work(in the antpath case) or I'm confused  
> about their usage(the myConfig case).
>
> What I'm looking for is something that will generate a classpath,  
> after resolving dependencies, similar to 'mvn  dependency:build-
> classpath'.

I guess Gradle 0.8 (to be released in September) will be your friend.

With Gradle 0.8 you can specify an user specific (e.g. emacs) init  
script that can be used in conjunction with an existing build.gradle.  
This init script could add a task to a gradle build at runtime. This  
task could process the dependencies as it suits you. For example it  
could send/write the value of configurations.runtime.asPath.

>
> Also, how do you discover the properties and methods for groovy DSL  
> objects?  I've looked at the groovy doc and javadoc but it seems  
> like there is something missing there: http://www.gradle.org/0.6.1/docs/groovydoc/org/gradle/api/internal/artifacts/dependencies/Dependencies.html 
>   For example, is that the "dependencies" reference?

Yes.

- Hans

--
Hans Dockter
Gradle Project Manager
http://www.gradle.org


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: gradle classpath to stdout