Coming Up for Air

Filtering Mail using JavaMail

Jason Lee 2013-09-04

At the Lee House, we have an email problem: there's just too much of it. Over the years of signing up for contests, coupons, and other things, we seem to have amassed a giant number of subscriptions to various lists, which gives us a lot of (usually) junk email. The simple solution, of course, is just to unsubscribe, but some of those are actually occasionally useful. Throw in a pinch of proscratination and laziness, and, well... it all just keeps coming. Email clients can help manage this by providing email filters to move these emails out of the inbox, but, in the case of Thunderbird, there are only so many rules you can add to one filter, so you either create multiple rules, or give up trying. Several months back, I moved these rules to a perl-based system, but, thanks to a hard drive crash, I lost all of those. Rather than rebuild that setup, which had its own limitations, I did what every good geek would do: I wrote my own, and here it is. :)

WebJars and JSF

Jason Lee 2013-08-28

WebJars , for those that haven't heard, is a project that takes popular client-side web libraries and packages them in JARs to make their use in Java-/JVM-based web apps simpler. The web site notes that you can easily see which libraries a project is using simply by looking at its dependencies, and that transitive dependencies automatically appear. It's a pretty compelling project, but, for some reason, it doesn't show how to integrate it with JSF. I'd like to think it's because it's so trivial, but I'll show it here anyway. :)

A Quick-start for Scala and Gradle

Jason Lee 2013-08-22

For those interested, here's a quick and simple project to get you started using Gradle and Scala together:

apply plugin: 'scala'

repositories{
    mavenCentral()
    mavenLocal()
}

dependencies{
    compile 'org.slf4j:slf4j-api:1.7.5'
    compile "org.scala-lang:scala-library:2.10.1"
    testCompile "junit:junit:4.11"
}

task run(type: JavaExec, dependsOn: classes) {
    main = 'Main'
    classpath sourceSets.main.runtimeClasspath
    classpath configurations.runtime
}
object Main extends App {
  println("Hello, world")
}

You can run the app using the custom task run:

$ gradle run
:compileJava
:compileScala
:processResources
:classes
:run
Hello, world

BUILD SUCCESSFUL

Total time: 9.79 secs

Remember to add --daemon for faster startup times for your Gradle builds.

Have fun!

Gradle, 'provided' scope, and Java EE 7

Jason Lee 2013-08-22

Maven has a dependency scope, provided, that indicates that the dependency should not be in the archive. Gradle does not provide such a scope out of the box, but it's easy enough to add. The following Gradle build demonstrates a very bare-bones Java EE 7 web application setup:

apply plugin: 'war'

repositories {
    mavenCentral()
    mavenLocal()
}

configurations {
    provided
}
sourceSets {
    main { compileClasspath += configurations.provided }
}

dependencies {
    provided 'javax:javaee-api:7.0'
}

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