Wednesday, August 24, 2011

Oracle XE change default http port

By default, 8080 is the port of oracle xe http listener, but normally we keep 8080 for web or application server. To change Oracle XE http port, just run sqlplus command then:

SQL> begin
2 dbms_xdb.sethttpport('9090');
3 end;
5 /


Maven surefire plugin and failsafe plugin

In my previous projects, we have been using surefire plugin for both unit test and integration test because we don't really have any housekeeping after integration-test phase in the build.

I just realized today that we should have used failsafe plugin rather than surefire for integration test. To use failsafe plugin add below into your project pom.xml


<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.9</version>
<configuration>
<includes>
<include>Sample.java</include>
</includes>
</configuration>
<executions>
<execution>
<id>integration-functional-test</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<includes>
<include>**/*IntegrationTest.java</include>
<include>**/selenium/**/*Test.java</include>
</includes>
<excludes>
<exclude>none</exclude>
</excludes>
</configuration>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>



If you want to make your build success even with integration test fail just remove the "verify" goal and execution.

Tuesday, August 23, 2011

Maven Web Prototype Project Archetype

Sometimes to create a java web application project prototype is really a daunting task. You need to config web.xml then Spring framework and Hibernate also Unit test, integration test and selenium test so on.

Maven provides the functionality to generate a project from archetype in seconds. An archetype is basically a template or skeleton of a project. More details are available here.

Now I have created an archetype archive attached here with a pom file.

To use the archetype, first you need to install the archive into your local maven repository by command


mvn install:install-file
-Dfile=web-prototype-archetype-1.0-SNAPSHOT.jar
-DpomFile=pom.xml


then generate your own project from the archetype


mvn archetype:generate
-DinteractiveMode=false
-DarchetypeGroupId=melbourne.k.ben
-DarchetypeArtifactId=web-prototype-archetype
-DarchetypeVersion=1.0-SNAPSHOT
-DgroupId=<your group id>
-DartifactId=<your artifact id>


So what inside my target project of this archetype? It is a simple web application based on Spring MVC. The detailed structure :


Web Tier: Tiles+ Spring MVC
DI: Spring and Spring Resource Bundle Message
Test: Mockito + selenium RC
App Server: Glassfish


Notice: the projects only tested in Maven2.0.9 and I haven't added Hibernate into it. Also I am planning to upgrade Spring to 3.0.6 currently using 2.5.6 and selenium RC is quite old as well should upgrade it to web driver.

Monday, August 15, 2011

Webspace and container bundle

Yesterday I was installing glassfish on ubuntu10 and accidentally found the link below. Somehow the download site of Sun is exposed to public, maybe it's been like this for a while and I didn't know.


Sun Portal Server Download

HTML5 and CSS3

Check this out expressive web.

So what can't be done at the client side anymore?

Wednesday, August 10, 2011

maven2 encoding settings

Recently I set up a development environment on Ubuntu10 and there was a problem with my maven build. Because most existing source code generated from windows and I had an encoding mapping error when building my project in Ubuntu.

To solve it just simply add a property into root pom file.

<properties>
<project.build.sourceEncoding>iso-8859-1</project.build.sourceEncoding>

<project.reporting.outputEncoding>iso-8859-1</project.reporting.outputEncoding>
</properties>

Maven Document