Coming Up for Air

Gradle Tip: Running a Single Test

Using Maven, to run a single test (class), you would issue mvn -Dtest=MyTest. Gradle has similar functionality (gradle -Dtest.single=MyTest), though it seems to be much more powerful. You can get all the details here .

Gradle + Arquillian + GlassFish Embedded

I've recently been migrating all of my personal projects to Gradle. Since I use Arquillian, that means migrating that part of the build as well. However, being still fairly new to Gradle, how to handle that integration wasn't immediately obvious. Thanks to Benjamin Muschko and Aslak Knutsen , I've finally gotten a working setup.

Gradle Tip: Seeing Standard Streams During Tests

Jason Lee 2013-09-10

I'm not a real big fan of using standard out as a debugging strategy (I prefer an IDE and break points, for what it's worth), but there are times when it's either necessary or just convenient. The standard Gradle configuration, though, makes this a bit more difficult than it probably should be. Fortunately, Gradle also makes it easy to change:

test {
    testLogging.showStandardStreams = true
}

If you'd like to make this change globally, that's also easy:

allprojects {
    tasks.withType(Test) {
        testLogging.showStandardStreams = true
    }
}

Gradle Tip: Attaching a Debugger

Maven offers a nice script to allow for attaching a debugger to your build, mvnDebug. Gradle does not. Again, though, Gradle makes it pretty easy to add this to your build.

Building "Fat Jars " with Gradle

Jason Lee 2013-09-04

Sometimes, such as when building command line Java apps, it would be nice to bundle all of the app's dependencies in a single jar so that the user need not collect and manage these. With Gradle, that can be easily accomplished with the following lines:

jar {
    from {
        configurations.compile.collect {
            it.isDirectory() ? it : zipTree(it)
        }
        configurations.runtime.collect {
            it.isDirectory() ? it : zipTree(it)
        }
    }
}

When you run gradle assemble, you should find your now very hefty jar in build/libs.

Search

Quotes

Sample quote

Quote source

About

My name is Jason Lee. I am a software developer living in the middle of Oklahoma. I’ve been a professional developer since 1997, using a variety of languages, including Java, Javascript, PHP, Python, Delphi, and even a bit of C#. I currently work for Red Hat on the WildFly/EAP team, where, among other things, I maintain integrations for some MicroProfile specs, OpenTelemetry, Micrometer, Jakarta Faces, and Bean Validation. (Full resume here. LinkedIn profile)

I am the president of the Oklahoma City JUG, and an occasional speaker at the JUG and a variety of technical conferences.

On the personal side, I’m active in my church, and enjoy bass guitar, running, fishing, and a variety of martial arts. I’m also married to a beautiful woman, and have two boys, who, thankfully, look like their mother.

My Links

Publications