See project issue 4. Use the buildNumber plugin rather than pom.version for the AMP module version because pom.version may contain alpha characters or -SNAPSHOT. Still need to use properties for the <scm/> tags.

git-svn-id: http://maven-alfresco-archetypes.googlecode.com/svn/trunk@72 04253f4f-3451-0410-a141-5562f1e59037
This commit is contained in:
damonrand
2008-07-29 14:03:20 +00:00
parent f22267f31a
commit 4770257e5b
2 changed files with 257 additions and 235 deletions

View File

@@ -23,7 +23,7 @@ module.id=${pom.groupId}.${pom.artifactId}
#module.aliases=myModule-123, my-module
module.title=${pom.name}
module.description=${pom.description}
module.version=${pom.version}
module.version=${buildNumber}
# The following optional properties can be used to prevent the module from being added
# to inappropriate versions of the WAR file.

View File

@@ -15,23 +15,22 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<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>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<packaging>amp</packaging>
<name>Maven Alfresco AMP Packaging Sample</name>
<!-- No shapshot or beta version, as this is used for filtering module.properties
As in http://wiki.alfresco.com/wiki/Developing_an_Alfresco_Module:
-->
<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>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<packaging>amp</packaging>
<name>Maven Alfresco AMP Packaging Sample</name>
<!-- An Alfresco version number must be of the form 1.2.3.4. Using 1.0-SNAPSHOT as the AMP version
will create an exception. See http://wiki.alfresco.com/wiki/Developing_an_Alfresco_Module:
"The version number must be made up of numeric values separated by dots. For example '2.1.56' is a valid version number, '2.3.4a' is not. "
If you want to use (and I do) maven snapshot capabilities than you could
remove the filtering and maintaining versions (pom and module.properties) aligned manually
-->
<version>${version}</version>
In order to be able to use Maven snapshots we cannot use the <version/> below as the AMP module
version. Instead we use the buildnumber-maven-plugin. This requires a scm connection.
-->
<version>${version}</version>
<description>Test AMP project</description>
<repositories>
<repository>
@@ -45,14 +44,14 @@
<url>http://repository.sourcesense.com/maven2</url>
</pluginRepository>
</pluginRepositories>
<properties>
<properties>
<!--Default for which src/main/properties/<env>/application.properties is loaded. NB:
used only for the 'test' profile (e.g. '-P test' on the mvn commandline)
jetty run deployment, does not impact AMP behavior which is typically environment independent
-->
<env>local</env>
<!-- Webapp used to test/develop locally the AMP -->
<webapp.name>${artifactId}-webapp</webapp.name>
-->
<env>local</env>
<!-- Webapp used to test/develop locally the AMP -->
<webapp.name>${artifactId}-webapp</webapp.name>
<!--
|
| By default the src/test/properties/local/application.properties uses the property "alfresco.data.location" to specify where
@@ -67,39 +66,39 @@
| (add a trailing slash, e.g. '/var/log/alfresco/' )
|
| Jetty embedded run logs by default in target/alfresco.log
-->
<alfresco.data.location>./alf_data_jetty</alfresco.data.location>
<alfresco.db.name>alf_jetty</alfresco.db.name>
<webapp.log.level>error</webapp.log.level>
<webapp.log.dir>${project.build.directory}/</webapp.log.dir>
<!-- End of testing webapp specific properties -->
<!-- Module specific build time properties -->
<module.log.level>debug</module.log.level>
</properties>
-->
<alfresco.data.location>./alf_data_jetty</alfresco.data.location>
<alfresco.db.name>alf_jetty</alfresco.db.name>
<webapp.log.level>error</webapp.log.level>
<webapp.log.dir>${project.build.directory}/</webapp.log.dir>
<!-- End of testing webapp specific properties -->
<!-- Module specific build time properties -->
<module.log.level>debug</module.log.level>
</properties>
<!--
need to list these as a provided so that Maven doesn't download them
and include them in the AMP, they are provided by Alfresco
-->
<dependencies>
<dependency>
<groupId>alfresco.community</groupId>
<artifactId>alfresco-repository</artifactId>
<version>2.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
-->
<dependencies>
<dependency>
<groupId>alfresco.community</groupId>
<artifactId>alfresco-repository</artifactId>
<version>2.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<!-- Example Jar dependency: will be properly packed into the AMP /lib directory
<dependency>
<groupId>rome</groupId>
<artifactId>opensearch</artifactId>
<version>0.1</version>
</dependency>
-->
-->
<!-- Example AMP dependency: will be properly overlayed in the WAR produced by the integration-test phase in profile 'webapp'
<dependency>
<groupId>org.alfresco.community</groupId>
@@ -107,59 +106,82 @@
<version>2.1.0</version>
<type>amp</type>
</dependency>
-->
-->
<!-- By default archetype assumes mysql for test webapp. Change src/test/properties/<env>/application.properties
FIXME: support in memory db for cleaner and safer test runs
-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.0.3</version>
</dependency>
<!-- Don't add here amp dependencies as it will break amp packaging -->
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.alfresco.maven.plugin</groupId>
<artifactId>maven-amp-plugin</artifactId>
<version>2.0.0</version>
<extensions>true</extensions>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.0.3</version>
</dependency>
<!-- Don't add here amp dependencies as it will break amp packaging -->
</dependencies>
<!-- The scm is required for the buildnumber-maven-plugin which is required for AMP version numbering -->
<scm>
<connection>scm:svn:http://domain.com/svn/trunk/</connection>
<developerConnection>scm:svn:https://${maven.username}@domain.com/svn/trunk/</developerConnection>
<url>http://domain.com/svn/trunk/</url>
</scm>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.alfresco.maven.plugin</groupId>
<artifactId>maven-amp-plugin</artifactId>
<version>2.0.0</version>
<extensions>true</extensions>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
<overlays>
<!-- This sample adds records management module in the finally built AMP
<overlay>
<groupId>org.alfresco.community</groupId>
<artifactId>recordsmanagement</artifactId>
<version>2.1.0</version>
<type>amp</type>
<!-- This sample adds records management module in the finally built AMP
<overlay>
<groupId>org.alfresco.community</groupId>
<artifactId>recordsmanagement</artifactId>
<version>2.1.0</version>
<type>amp</type>
</overlay>
-->
<!-- The current AMP is always last in order to overwrite other modules' modules.properties
-->
<!-- The current AMP is always last in order to overwrite other modules' modules.properties
<overlay></overlay>
-->
</overlays>
</configuration>
</plugin>
</plugins>
<!-- Copies and filters resources in build folder so maven-amp-plugin can pick them up -->
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
<excludes>
<exclude>**README-*</exclude>
</excludes>
-->
</overlays>
</configuration>
</plugin>
</plugins>
<!-- Copies and filters resources in build folder so maven-amp-plugin can pick them up -->
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
<excludes>
<exclude>**README-*</exclude>
</excludes>
</resource>
<!-- Copies and filters AMP config in the proper package 'alfresco/module/${groupId}.${artifactId}' so to enforce
full module naming single sourcing from POM properties -->
@@ -171,85 +193,85 @@
<exclude>**README-*</exclude>
</excludes>
</resource>
</resources>
</build>
<profiles>
<!-- Profile used to trigger war creation and integration within Jetty embedded -->
<profile>
<id>webapp</id>
<build>
<filters><filter>src/test/properties/${env}/application.properties</filter></filters>
<defaultGoal>jetty:run-exploded</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-amps</id>
<phase>process-resources</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<includeTypes>amp</includeTypes>
<outputDirectory>${build.directory}/${webapp.name}</outputDirectory>
<excludes>META*</excludes>
</configuration>
</execution>
</executions>
<dependencies>
</resources>
</build>
<profiles>
<!-- Profile used to trigger war creation and integration within Jetty embedded -->
<profile>
<id>webapp</id>
<build>
<filters><filter>src/test/properties/${env}/application.properties</filter></filters>
<defaultGoal>jetty:run-exploded</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-amps</id>
<phase>process-resources</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<includeTypes>amp</includeTypes>
<outputDirectory>${build.directory}/${webapp.name}</outputDirectory>
<excludes>META*</excludes>
</configuration>
</execution>
</executions>
<dependencies>
<!-- This is required to be re-defined explicitly at plugin level as otherwise the 'amp' extension
unArchiver won't be available to the maven-dependency-plugin -->
<dependency>
<groupId>org.alfresco.maven.plugin</groupId>
<artifactId>maven-amp-plugin</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<executions>
<!-- Runs war packaging when 'integration-test' phase is called -->
<execution>
<id>it</id>
<phase>package</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
<configuration>
<primaryArtifact>false</primaryArtifact>
<!-- Don't remove the following line otherwise WAR and AMP builds will be done in the same folder, with unexpected results -->
<webappDirectory>${build.directory}/${webapp.name}</webappDirectory>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
<warSourceExcludes>licenses/**</warSourceExcludes>
<webResources></webResources>
<webResources>
<resource>
<directory>${build.testOutputDirectory}</directory>
<targetPath>WEB-INF/classes</targetPath>
<filtering>true</filtering>
<includes>
<include>**</include>
</includes>
</resource>
<!-- Here we add default this AMP web/ resources-->
<resource>
<directory>src/main/webapp</directory>
<targetPath>WEB-INF/licenses</targetPath>
<includes>
<include>licenses/*.*</include>
</includes>
<filtering>false</filtering>
</resource>
</webResources>
</configuration>
unArchiver won't be available to the maven-dependency-plugin -->
<dependency>
<groupId>org.alfresco.maven.plugin</groupId>
<artifactId>maven-amp-plugin</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<executions>
<!-- Runs war packaging when 'integration-test' phase is called -->
<execution>
<id>it</id>
<phase>package</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
<configuration>
<primaryArtifact>false</primaryArtifact>
<!-- Don't remove the following line otherwise WAR and AMP builds will be done in the same folder, with unexpected results -->
<webappDirectory>${build.directory}/${webapp.name}</webappDirectory>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
<warSourceExcludes>licenses/**</warSourceExcludes>
<webResources></webResources>
<webResources>
<resource>
<directory>${build.testOutputDirectory}</directory>
<targetPath>WEB-INF/classes</targetPath>
<filtering>true</filtering>
<includes>
<include>**</include>
</includes>
</resource>
<!-- Here we add default this AMP web/ resources-->
<resource>
<directory>src/main/webapp</directory>
<targetPath>WEB-INF/licenses</targetPath>
<includes>
<include>licenses/*.*</include>
</includes>
<filtering>false</filtering>
</resource>
</webResources>
</configuration>
<dependencies>
<!-- This is required to be re-defined explicitly at plugin level as otherwise the 'amp' extension
unArchiver won't be available to the maven-war-plugin -->
@@ -259,77 +281,77 @@
<version>2.0.0</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<executions>
<!-- Runs jetty when 'integration-test' phase is called -->
<execution>
<id>it</id>
<phase>integration-test</phase>
<goals>
<goal>run-exploded</goal>
</goals>
<configuration>
<contextPath>/${webapp.name}</contextPath>
<webApp>${pom.build.directory}/${webapp.name}</webApp>
<scanIntervalSeconds>10</scanIntervalSeconds>
<connectors>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>8080</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<executions>
<!-- Runs jetty when 'integration-test' phase is called -->
<execution>
<id>it</id>
<phase>integration-test</phase>
<goals>
<goal>run-exploded</goal>
</goals>
<configuration>
<contextPath>/${webapp.name}</contextPath>
<webApp>${pom.build.directory}/${webapp.name}</webApp>
<scanIntervalSeconds>10</scanIntervalSeconds>
<connectors>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>8080</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<!-- When invoking 'mvn integration-test', the following alf configs are added to the test war in order to be able to run it seamlessly.
NB: the application.properties file is filtered with alfresco.db.name and alf.data.location POM properties as default configuration
-->
<testResources>
<testResource>
<filtering>true</filtering>
<directory>src/test/resources</directory>
</testResource>
<!-- Includes default properties for alfresco test war -->
<testResource>
<filtering>true</filtering>
<directory>src/test/properties/${env}</directory>
<targetPath>alfresco/extension</targetPath>
</testResource>
-->
<testResources>
<testResource>
<filtering>true</filtering>
<directory>src/test/resources</directory>
</testResource>
<!-- Includes default properties for alfresco test war -->
<testResource>
<filtering>true</filtering>
<directory>src/test/properties/${env}</directory>
<targetPath>alfresco/extension</targetPath>
</testResource>
<!-- src/main/config/ is copied into ==> target/test-classes/alfresco/module/${groupId}.${artifactId} to
be picked up by the maven-war plugin
Best practice tacken from recordsmanagement.amp, is enforced troughout the whole archetype.
This convention is also used for module.properties filtering.
-->
<testResource>
<filtering>true</filtering>
<directory>.</directory>
<includes>
<include>module.properties</include>
</includes>
<targetPath>alfresco/module/${groupId}.${artifactId}</targetPath>
</testResource>
</testResources>
</build>
-->
<testResource>
<filtering>true</filtering>
<directory>.</directory>
<includes>
<include>module.properties</include>
</includes>
<targetPath>alfresco/module/${groupId}.${artifactId}</targetPath>
</testResource>
</testResources>
</build>
<!-- Here you can add test dependencies you want to have included in the the WAR (not in the AMP, built in the main profile)
|
| Typical use case: add here additional AMPs that you want to test compatibility of with the current module
|
-->
<dependencies>
<!-- This is the alfresco version you're testing the AMP against. Don't remove if you want jetty to be able to deploy a WAR :) -->
<dependency>
<groupId>alfresco.community</groupId>
<artifactId>alfresco</artifactId>
<version>2.1.0</version>
<type>war</type>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
-->
<dependencies>
<!-- This is the alfresco version you're testing the AMP against. Don't remove if you want jetty to be able to deploy a WAR :) -->
<dependency>
<groupId>alfresco.community</groupId>
<artifactId>alfresco</artifactId>
<version>2.1.0</version>
<type>war</type>
</dependency>
</dependencies>
</profile>
</profiles>
</project>