I put the properties in my maven pom.xml. First off, I chop up the whole web app so that there are separate jars for the different layers; persistenc/db, service, web (e.g., controllers for spring mvc), and war. The war project has the jsps and properties/config/xml files in src/main/resources.
For example, my parent pom starts like this:
<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>edu.berkeley.ist.waitlist</groupId>
<artifactId>waitlist-parent</artifactId>
<modules>
<module>../waitlist-core</module>
<module>../waitlist-db</module>
<module>../waitlist-web</module>
<module>../waitlist-war</module>
<module>../waitlistd</module>
</modules>
and
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/hbm</directory>
<filtering>true</filtering>
</resource>
</resources>
and
<dependencyManagement>
<!-- dependencies with exclusions -->
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${version.springframework}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
Then I have a bunch of profiles, for the various builds:
<profiles>
<!-- ========================================================== -->
<!-- local, hsql -->
<!-- ========================================================== -->
<profile>
<id>localhost-hsql</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<!-- need to specify ${basedir} so that hsql creates its files in the right place -->
<db2.url>jdbc:hsqldb:file:${basedir}/target/waitlistv2;shutdown=true</db2.url>
<db2.user>sa</db2.user>
<db2.password />
<jdbc-db2.driverClass>org.hsqldb.jdbcDriver</jdbc-db2.driverClass>
<db2.schema>public</db2.schema>
<db2.hibernate.default_schema>public</db2.hibernate.default_schema>
<db2.hibernate.dialect>org.hibernate.dialect.HSQLDialect</db2.hibernate.dialect>
<dbunit.dataTypeFactoryName>org.dbunit.ext.hsqldb.HsqldbDataTypeFactory</dbunit.dataTypeFactoryName>
<hbmtool.haltOnError>false</hbmtool.haltOnError>
<log.filename>/tmp/waitlist.log</log.filename>
</properties>
</profile>
For example, in waitlist-war/src/main/resources is the file logback.xml, and it starts with
<configuration debug="true">
<appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="RootFileAppender">
<!-- set in the pom.xml file -->
<file>${log.filename}</file>
So you can see how the log.filename property from the pom is used due to maven's filtering.
(I'm specifying all of the versions in the parent's pom and the child projects just specify the dependencies they use, but without the version number. I'm not sure if this is the correct way, best practice, etc.
Also, waitlist-war depends on waitlist-web, waitlist-web depends on waitlist-core (my service layer), and waitlist-core depends on waitlist-db. Waitlistd is a separate app that has no ui to speak of and it depends on waitlist-core.)