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.aliases=myModule-123, my-module
module.title=${pom.name} module.title=${pom.name}
module.description=${pom.description} 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 # The following optional properties can be used to prevent the module from being added
# to inappropriate versions of the WAR file. # to inappropriate versions of the WAR file.

View File

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