Posts tagged ‘cdi’

Introduction

Here you can find some seam3 archetypes that will help you get started when generating new application for tomcat 6/7.

They extend weld archetypes with some pieces extra:

  • richfaces 4.2
  • JPA2/Hibernate transactional EntityManager
  • tomcat data source pool

Seam3/tomcat archetypes

Because it took me a while to put all of them together, I decided to share a shortcut for those trying to use tomcat+jpa. You can use them directly from my private repository. There are two seam3 archetypes (due to this bug):

Available options

In order to make your work more productive I added some extra options, once you fill them, you have

name required default
jdbcUrl required
jdbcUser required
jdbcPassword required
jdbcJndiName false jdbc/Seam3Test
jdbcDriverClassName false com.mysql.jdbc.Driver
hibernateDialect false org.hibernate.dialect.MySQL5InnoDBDialect

Usage

So just add my public repo to your settings.xml:

<repository>
    <id>repo.bedkowski.pl</id>
    <url>http://repo.bedkowski.pl/maven2</url>
</repository>

And for mysql you can generate project with:

mvn archetype:generate \
        -DarchetypeArtifactId=seam3-rf4-jpa2-tomcat7 \
        -DarchetypeGroupId=pl.bedkowski.archetypes \
        -DarchetypeVersion=1.0 \
        -DgroupId=pl.bedkowski.code \
        -DartifactId=seam3-generated \
        -Dversion=1.0-SNAPSHOT \
        -DjdbcUser=test \
        -DjdbcPassword=test \
        -DjdbcUrl='jdbc:mysql://localhost/test?useUnicode=true&characterEncoding=utf8' \
        -DinteractiveMode=false

Go to your seam3-generated direcotry and run:

mvn clean install 

And in target directory you can find 2 wars:

  • seam3-generated.war
  • seam3-generated-nolib.war

First one is obvious and second one is just a convenience in case you need to synchronize your war on external server – in which case send over libs each time is time consuming, so you can store libs on your server and just send -nolib.war and recompress the file with libs appended.

Source code

As usual sources available on github: