OK, the directory structure of you project under the jar directory will probably look something like this:

src/main/java
src/main/resources
src//test/java
src/test/resources

OK, the next part, a POM for your POJOs

<?xml version="1.0" encoding="UTF-8"?>
<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>martijnverburg</groupId>
<artifactId>martijnverburg-jar</artifactId>
<packaging>jar</packaging>
<version>0.0.1</version>

<name>martijnverburg : jar</name>

<build>
<!-- We want to do some filtering on our config files -->
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<filters>
<!-- The filters live here -->
<filter>../../project.properties</filter>
<filter>../module.properties</filter>
</filters>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.0</version>
</plugin>
</plugins>
</build>
<dependencies>
<!-- Logging library -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
<scope>provided</scope>
</dependency>
</dependency>
..
..
..
Lots more dependencies
</dependencies>
</project>

Our real POM is actually massive with all sorts of code coverage plugins, test plugins, reporting plugins, developer and license info etc etc. But you can pick up most of that from the maven docs on the website.

Right, Have a go at build that first and let us know how you get on. We can then walk through the WAR and EAR poms/projects.

Cheers,
Martijn

On Dec 4, 2008 2:17pm, [EMAIL PROTECTED] wrote:
I'll post this to everyone as people can search this archive and maybe
get some help from it.

Disclaimer: I am NOT a Maven expert, I'm sure there are several best
practices that I'm breaking here,
so take this with a grain of salt please.

OK, let's start with the basics, you'll need a project layout something
similar to this:

projectname
/ejb
/environment
/jar
/war
/ear
distribution.xml
pom.xml
project.properties

Each of those sub directories will be maven projects in their own right.
The pom.xml at the root of the project is a
parent pom that can wrap it all together and provide some
environmentalisation for it.

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";>
4.0.0modelVersion>
org.martijnverburggroupId>
martijnverburg-parent
0.0.1
pom

martijnverburg : Parent Project


jar
ejb
war
ear





maven-assembly-plugin

martijnverburg-${server}-${env}

project.propertiesfilter>
environment/${server}/${env}/environment.properties/filter>


distribution.xmldescriptor>







A Couple of Notes:

1,) project.properties is a hint to you that you need to think about have
environmentalised builds. A file like
project.properties is a _very_ simple step towards this. Normally you
would use build profiles or (as we do)
use several environment properties files (we reference which ones we want
by passing in -D parameter on the command line,
as you can see we pass in the $server and $env variables). You may not
need this.

2,) distribution.xml is used for assembly purposes, see the
maven:assembly plugin for details. We use this as
we not only distribute an EAR but also several configuration files as
part of out project. You may not need this.

In the next post I'll go through the jar project/pom, for dealing with
your POJOs

Cheers,
Martijn

On Dec 4, 2008 1:53pm, Mario Alsini [EMAIL PROTECTED]> wrote:
>
>
> Hi Martin,
>
> can you please give me which your project is?
> So I can study a real example.
> I already read the 2 books bat for me it isn't simple.
> With a real exsample it'll be better.

Reply via email to