Thursday, November 12, 2009

Bootstrap GWT2 with maven, UiBinder and i18n

I'm setting up a boostrap project for GWT 2 witch would use maven 2, UiBinder and i18n.
The idea is to centralize resources about UiBinder and test GWT 2, the result being used as a template project for real GWT 2 projects.

I'm quite new to GWT (2 days old...), so it is also a learning project. If it could be of any use for you, don't hesitate to use it - or enhance it, or make comments :)

For now, it's based on GWT 2.0.0-ms2, and some configuration may be specific to my environment (Linux&Firefox 3.5).

It's available here: http://github.com/fanf/gwt2-mvn-bootstrap

Tuesday, November 10, 2009

Maven2 bootstrap pom.xml for SLF4J and no-commons-logging

Each time I start a new Java project with Maven 2, I need to write the same dependencies again and again: SLF4J and no commons-logging because it's evil (and SpringFramework seems to want to keep it), Joda Time by default, some properties, etc.

So, that's the template pom.xml I use for the bootstrap, if it may help anybody here (it uses logback for logging, as it's more efficient than Log4j with SLF4J, but feel free to use what you want):

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.test</groupId>
  <artifactId>test</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>

  <properties>
    <!-- UTF-8 for everyone -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <slf4j-version>1.5.8</slf4j-version>
    <logback-version>0.9.17</logback-version>
  </properties>

  <description>Template for project without Commons-logging</description>

  <repositories>
    <repository>
      <id>no-commons-logging</id>
      <name>No-commons-logging Maven Repository</name>
      <layout>default</layout>
      <url>http://no-commons-logging.zapto.org/mvn2</url>
      <snapshots><enabled>false</enabled></snapshots>
    </repository>
  </repositories>

  <pluginRepositories>
  </pluginRepositories>

  <build>
    <plugins>
    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>joda-time</groupId>
      <artifactId>joda-time</artifactId>
      <version>1.6</version>
    </dependency>

    <!--  test -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.7</version>
      <scope>test</scope>
    </dependency>

    <!--
      All the following is related to our will to NOT use Commong-logging. Never. 
      And framework we depend on won't bring commons-loggin nether (I'm looking at
      you, stringframework).
    -->
    <!-- use no-commons-logging -->
    <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
      <version>99.0-does-not-exist</version>
    </dependency>
    <!-- no-commons-logging-api, if you need it -->
    <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging-api</artifactId>
      <version>99.0-does-not-exist</version>
    </dependency>
    <!-- slf4j commons-logging replacement -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jcl-over-slf4j</artifactId>
      <version>${slf4j-version}</version>
    </dependency>
    <!-- other slf4j jars -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${slf4j-version}</version>
    </dependency>
    <!-- using slf4j native backend -->
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-core</artifactId>
      <version>${logback-version}</version>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <version>${logback-version}</version>
    </dependency>
  </dependencies>
</project>

  © Blogger template 'Minimalist G' by Ourblogtemplates.com 2008

Back to TOP