gradle

How do I reference a classpath from Gradle 0.6

I have a project using Gradle as the build tool and I have to make use of the Java ant task. One of the sub elements in this task is a reference to a classpath and I would like to use refid. The build script uses Gradle's WAR plugin. Since the compile task works without any problem I know that the classpath is set up correctly: depende...

Why use Gradle instead of Ant or Maven?

What does another build tool targeted at Java really get me? If you use Gradle over another tool, why? (See also Why use Buildr instead of Ant or Maven) ...

Buildr, Gradle or wait for Maven 3?

I am really tired of struggling with Maven 2 all the time. Build tools should not be in the way. Recently I have been looking at Buildr and Gradle. Maven 3 seems to fix some of the struggles. So, what should I go for now? Buildr? Gradle? Or wait a year for Maven 3? ...

How to get a reference to the jar file produced by Gradle build?

I need to sign a jar after the jar task is being done in gradle. I have a need to reference the produced jar file from the build, and I can create recreate the jar file, but I really look for a property that does this for me. Here is how I've done it: jar.doLast { jarfile = project.libsDir.path + File.separator + project.Name + '-' ...

How do I force inclusion of empty directories when copying a file tree using gradle 0.8?

Using Gradle 0.8, I have the following file structure source/ stuff/ file.txt empty/ Which I want copied to create target/ stuff/ file.txt empty/ So I tried this: def sourceTree = fileTree(dir: 'source') def targetDir = file(dir: 'target') copy { from sourceTree into targetDir } But instead I en...

How do I conditionally include or exclude a file from an archetype when project is generated?

I'm creating Maven 2 archetypes for our project (Weld). I would like to be able to control which files are placed into the generated project based on the value of a property that is defined during archetype:generate. For instance, I foresee the following prompt: Define value for groupId: : com.example Define value for artifactId: : mypr...

Any best practices or tools for Ivy repositories?

we use Gradle for building Java projects and at the moment we have Ivy repositories to store third-party artifacts and also to publish our own artifacts into (repo is build using Gant scripts and the Ivy ANT tasks). but repo management is basic. Gradle is able to work with a maven repo as well, so switching to a Maven artifact manager l...

Where can I find a single example expressed in Ivy, Maven, Gant, and Gradle?

I'd like to find a simple, non-trivial Java project that is expressed in terms of Ant + Ivy, Maven, Gant, and Gradle. I'm not interested in each tool's varied sample demos. Where can I find such an example, for reference? ...

How can I import one Gradle script into another?

Hi all, I have a complex gradle script that wraps up a load of functionality around building and deploying a number of netbeans projects to a number of environments. The script works very well, but in essence it is all configured through half a dozen maps holding project and environment information. I want to abstract the tasks away i...

Including subprojects using a wildcard in a Gradle settings file

In Gradle you need to define subprojects to be built in a 'settings.gradle' file. To build three child projects, you would do something like this: include "child1", "child2", "child3" The problem I'm having is that I have quite a few projects to include. Is there a way to use a wildcard in this definition? I'm looking for something li...

Run groovy script from within gradle

What's the best way to create a gradle task, which runs a groovy script? I realize that gradle build files are groovy, so I would think it would be possible to do something like this: task run << { Script app = new GroovyShell().parse(new File("examples/foo.groovy")) // or replace .parse() w/ a .evalulate()? app.run() } I...

What are real-world examples of Gradle's dependency graph?

As noted in the documentation, Gradle uses a directed acyclic graph (DAG) to build a dependency graph. From my understanding, having separate cycles for evaluation and execution is a major feature for a build tool. e.g. The Gradle doc states that this enables some features that would otherwise be impossible. I'm interested in real-world...

Is there a way to split/factor out common parts of Gradle build

We have several independent builds (each independent build is a multi-project build). The main build scripts become quite big as we have a set of common tasks reused by subprojects as well as there is a lot of repeation between indepedent builds. What we are looking for is: A way to split main build file into smaller files A way to reu...

Gradle: Make a 3rd party jar available to local gradle repository

Hi, currently, I'm testing Gradle as an alternative to Maven. In my projects, there are some 3rd party jars, which aren't available in any (Maven) repositories. My problem is now, how could I manage it to install these jars into my local .gradle repository. (If it's possible, I don't want to use the local Maven repository, because Gradl...

What is the difference between these task definition syntaxes in gradle?

A) task build << { description = "Build task." ant.echo('build') } B) task build { description = "Build task." ant.echo('build') } I notice that with type B, the code within the task seems to be executed when typing gradle -t - ant echoes out 'build' even when just listing all the various available tasks. The description is als...

Gradle java.util.logging.Logger output in unit tests

Dear All: Sorry this is probably a very simple question. I am using gradle http://www.gradle.org/ for my development environment. It works quite well! I have written a simple unit test that uses HtmlUnit and my own package. For my own package, I use java.util.Logger. HtmlUnit seems to use commons logging: http://htmlunit.sourceforge...

Correct location (in Gradle) to put code that should be run in _all_ test cases?

Dear All: Just wondering... I have some code (disabling certain logging output) that I'd like to be run before all tests... I do not see any such examples for JUnit/Groovy testing in the samples directory... is there a good/correct place to put such code? Thank you! Misha p.s. I am using the 0.9 preview 3 version. ...

Gradle/ivy use cached repos?

Dear All: I would like Grade/Ivy to use cached versions of my jars, as it takes ~20 seconds to check every time for updates. Is this possible? Thank you Misha ...

Capture console output in TestNG?

Dear All: I am using TestNG+ReportNG per wiki instructions in gradle (I fixed on cookbook as default example did not work form me). http://docs.codehaus.org/display/GRADLE/Cookbook#Cookbook-addreporters I would like to somehow capture console output in TestNG. Is this possible? Thank you Misha ...

testng and gradle - see output from deadlocked tests?

If I have a test that hangs I don't seem to get any results. Is there any way to see output live? Thank you Misha ...