Compiling CoffeeScript with Maven

CoffeeScript is a neat language that is transcompiled into JavaScript but is more predictable and allows to write the same code with 1/3 fewer lines and of course with a (imho) nicer syntax. CoffeeScript is nice but a vivid integration into our application build lifecycle with Maven is better and that is what the following example is all about. Maven Dependencies Though there are some alternatives, we’re using brew here so please add the following dependency to your Maven project: ...

May 18, 2012 · 2 min · 375 words · Micha Kops

Wiring made easy using OSGi Blueprint and Apache Karaf

The OSGi Blueprint Container specification allows us to use dependency injection in our OSGi environment, declarative import and export of OSGi services, registering lifecycle listeners and wiring dependencies into our services with a few lines of XML code. In the following tutorial we’re first building an OSGi bundle classical style and afterwards take a trip into the advantages of the Blueprint specification. Our OSGi container of choice here will be Apache Karaf a lightweight container with a lot of nice features and – of course – blueprint enabled… ...

April 16, 2012 · 9 min · 1705 words · Micha Kops

Snippet: Mixing Scala, Java in a Maven Project

Having just returned from the Atlassian Camp 2012 I just toyed around with Java and Scala and wanted to share the following snippet that demonstrates how to mix code from both languages in a Maven project using the maven-scala-plugin. Setting up the Maven Project First create a new Maven project in your IDE or by running mvn archetype:generate. In the next step, add the dependency for scala-library and the scala maven repositories to your pom.xml and hook the maven-scala-plugin to Maven’s lifecycle. My pom.xml finally looks like this one: ...

March 23, 2012 · 2 min · 327 words · Micha Kops

Selenium WebDriver, Selenium Server and PageObjects by Example

A lot has changed since Selenium RC and WebDriver has given us a new syntax to write tests for our web pages. PageObjects add an abstraction to the pages under test and finally we’re able to programmatically start Selenium server instances and use them to run the tests. In the following tutorial, we’re writing some tests using PageObjects, WebDriver, Selenium Server and finally we’re even taking some screenshots of our tested web pages.. ...

March 6, 2012 · 4 min · 787 words · Micha Kops

Create Mobile Websites using Java Server Faces and PrimeFaces Mobile

The more smartphones and tablets are sold the bigger the need for a mobile version of a modern website. PrimeFaces Mobile helps us developers here and allows us to quickly create mobile websites that display well on an iPhone, Android, Palm, Blackberry, Windows Mobile and others. In the following tutorial we’re going to create a web application that is using Java Server Faces 2.1, PrimeFaces 3.1 and PrimeFaces Mobile 1.0 and runs on a simple web container like Tomcat or Jetty. ...

January 8, 2012 · 5 min · 990 words · Micha Kops

Maven Tomcat Plugin: Adding Authentication to an Embedded Tomcat

The Tomcat Maven Plugin not only allows us to deploy our mavenized application to an existing Tomcat server but also to run our web application with an embedded instance from our project’s directory. Recently I needed to add basic authentication to such an instance and wanted to share the steps necessary here Prerequisites We just need Maven and a JDK … Java Development Kit >= 6 Maven 3 Project Setup I am using the webapp archetype here We’re adding the following configuration for the Tomcat plugin to your pom.xml – my final descriptor is this one pom.xml...

October 12, 2011 · 3 min · 616 words · Micha Kops

Java EE 6 Development using the Maven Embedded GlassFish Plugin

Today we’re going to take a look at the Maven Embedded GlassFish Plugin and how it allows us quick creation of GlassFish server instances in no time and Java EE 6 application deployment. Figure 1. GlassFish + Maven With a few lines of configuration in your Maven’s pom.xml we’ve got a running GlassFish instance and are able to redeploy our application fast by pressing enter in our console. In the following tutorial we’re going to build a Java EE 6 Web Application with a stateless session bean and a web servlet and finally deploy – and redeploy the application using the Maven GlassFish Plugin. ...

September 20, 2011 · 5 min · 978 words · Micha Kops

Screenscraping made easy using jsoup and Maven

Sometimes in a developer’s life there is no clean API available to gather information from a web application .. no SOAP, no XML-RPC and no REST .. just a website hiding the information we’re looking for somewhere in its DOM hierarchy – so the only solution is screenscraping. Screenscraping always leaves me with a bad feeling – but luckily there is a tool that makes this job at least a bit easier for a developer .. jsoup to the rescue! ...

August 30, 2011 · 3 min · 526 words · Micha Kops

Contract-First Web-Services using JAX-WS, JAX-B, Maven and Eclipse

Using the contract-first approach to define a web service offers some advantages in contrast to the code-first approach. In the following tutorial we’re going to take a look at some details of this approach and we’re going to implement a real SOAP service using JAX-WS, Maven and the Eclipse IDE. Finally we’re going to run our service implementation on an embedded Jetty instance and we’re going to take a look at soapUI and how to test our service using this neat tool. ...

August 23, 2011 · 9 min · 1777 words · Micha Kops

Integrating Groovy in your Maven builds using GMaven

Often ant tasks are used in Maven builds but wouldn’t it be more attractive to integrate the Groovy language into our build process? GMaven is the answers to this problem and brings together Maven and Groovy. It allows us to execute Groovy scripts inline from our Maven configuration, from a local script or even from a remote location. In the following short examples I am going to show how to configure Maven to execute Groovy scripts from different locations. ...

July 12, 2011 · 4 min · 655 words · Micha Kops