Java EE7 Maven Dependency against Glassfish 4.x snapshot builds

Since upcoming changes and new features for EE7 are not yet published to Maven Central, you can build against the snapshot builds in the java.net repository. Add this to your pom.xml to add a reference to the java.net repo:

<repositories>
<repository>
<id>snapshot-repository.java.net</id>
<name>Java.net Snapshot Repository for Maven</name>
<url>https://maven.java.net/content/repositories/snapshots/</url>
<layout>default</layout>
</repository>
</repositories>

To add dependencies against EE7 features, add a dependency to a latest Glassfish 4.0-x snapshot build which already includes early versions for some of the new EE7 features:

<dependency>
<groupId>org.glassfish.main</groupId>
<artifactId>javaee-api</artifactId>
<version>4.0-b33</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.glassfish.main</groupId>
<artifactId>javax.ejb</artifactId>
<version>4.0-b33</version>
</dependency>

Booting your Windows Bootcamp partition in VirtualBox

I have XP in my Bootcamp partition which I occasionally boot to run apps that I don’t have on Mac OS X, usually it’s for a Windows game. It annoys me to switch between Mac OS X and booting Windows from Bootcamp, as it takes a while to switch back and forth. The only reason I’ve ever considered buying Fusion or Parallels is to be able to boot from the Bootcamp partition and avoid having two Windows installs – one in Bootcamp and one on a virtual disk. Sometimes it’s fine to boot in a virtual machine, but othertimes you really want to boot natively to make full use of the graphics card and DirectX etc. Turns out you can set up VirtualBox to easily boot from a Bootcamp partition, and avoid having two installs.

I followed the instructions here, and after a bit of fiddling with with VirtualBox settings for my new VM, it booted fine. The instructions are for booting Windows 7 from Bootcamp in VirtualBox, but it works the same for XP too.

JSF conditional text output

Use an EL expression in the rendered attribute, for example:

<h:outputText value="some conditional message" rendered="#{! empty someManagedBean.someProperty}" />