08-29-2012 05:23 AM
mvn archetype:generate -DarchetypeGroupId=org.alfresco -DarchetypeArtifactId=maven-alfresco-amp-archetype -DarchetypeVersion=3.9.1 -DgroupId=com.someco -DartifactId=someco-repo -Dversion=1.0-SNAPSHOT -DarchetypeRepository=https://artifacts.alfresco.com/nexus/content/repositories/releases -DinteractiveMode=false
cd someco-repo
mvn install
[INFO] Scanning for projects…
[INFO] ————————————————————————
[ERROR] BUILD ERROR
[INFO] ————————————————————————
[INFO] Error building POM (may not be this project's POM).
Project ID: org.alfresco.maven.plugin:maven-amp-plugin
POM Location: C:\Users\alf\.m2\repository\org\alfresco\maven\plugin\maven-amp-plugin\3.0.4\maven-amp-plugin-3.0.4.pom
Reason: Not a v4.0.0 POM. for project org.alfresco.maven.plugin:maven-amp-plugin at C:\Users\alf\.m2\repository\org\alfresco\maven\plugin\maven-amp-plugin\3.0.4\maven-amp-plugin-3.0.4.pom
[INFO] ————————————————————————
[INFO] For more information, run Maven with the -e switch
[INFO] ————————————————————————
[INFO] Total time: < 1 second
[INFO] Finished at: Wed Aug 29 10:08:21 BST 2012
[INFO] Final Memory: 2M/89M
[INFO] ————————————————————————
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="https://maven.alfresco.com/nexus/content/groups/public/org/alfresco/maven/plugin/maven-amp-plugin/3....">here</a>.</p>
<hr>
<address>Apache/2.2.3 (Red Hat) Server at maven.alfresco.com Port 80</address>
</body></html>
<?xml version="1.0" encoding="UTF-8"?>
<!–
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version
2.0 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Unless required by
applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. 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>com.someco</groupId>
<artifactId>someco-repo</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. " 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>1.0-SNAPSHOT</version>
<description>Test AMP project</description>
<repositories>
<repository>
<id>alfresco-public-snapshots</id>
<url>http://maven.alfresco.com/nexus/content/groups/public-snapshots</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
</snapshots>
</repository>
<repository>
<id>alfresco-public</id>
<url>http://maven.alfresco.com/nexus/content/groups/public</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>alfresco-public</id>
<url>http://maven.alfresco.com/nexus/content/groups/public</url>
</pluginRepository>
<pluginRepository>
<id>alfresco-public-snapshots</id>
<url>http://maven.alfresco.com/nexus/content/groups/public-snapshots</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
<properties>
<!–
Default for which src/main/properties/<env>/alfresco-global.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>${project.artifactId}-webapp</webapp.name>
<!–
| | By default the src/test/properties/local/alfresco-global.properties
uses the property "alfresco.data.location" to specify where |
alf_data gets created. | For local jetty:run deployment default
creation dir is under project root folder (as location is specified
relatively to run | dir). Please add alf_data_jetty in svn/cvs
ignores in order not to commit that. You can also specified a
different (out of the | sproject) folder | by editing the following
properties. | DB is also configurable here. Of course keep in sync
these two values otherwise you'll get integrity errors. | | Empty log
dir creates file alfresco.log in appserver default dir. You can also
specify a meaningful log directory for the server | (add a trailing
slash, e.g. '/var/log/alfresco/' ) | | Jetty embedded run logs by
default in target/alfresco.log
–>
<alfresco.version>4.0.b</alfresco.version>
<alfresco.edition>community</alfresco.edition>
<alfresco.data.location>./alf_data_jetty</alfresco.data.location>
<alfresco.db.name>alf_jetty</alfresco.db.name>
<alfresco.db.username>alfresco</alfresco.db.username>
<alfresco.db.password>alfresco</alfresco.db.password>
<alfresco.db.params>MODE=PostgreSQL;AUTO_SERVER=TRUE;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=10000;MVCC=TRUE</alfresco.db.params>
<alfresco.db.url>jdbc:h2:${alfresco.data.location}/h2_data/${alfresco.db.name};${alfresco.db.params}</alfresco.db.url>
<alfresco.db.datasource.class>org.h2.jdbcx.JdbcDataSource</alfresco.db.datasource.class>
<webapp.log.level>error</webapp.log.level>
<webapp.log.dir></webapp.log.dir>
<!– End of testing webapp specific properties –>
<!– Module specific build time properties –>
<module.log.level>debug</module.log.level>
<spring.version>3.0.5.RELEASE</spring.version>
</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>org.alfresco</groupId>
<artifactId>alfresco-core</artifactId>
<version>${alfresco.version}</version>
<scope>provided</scope>
<classifier>${alfresco.edition}</classifier>
</dependency>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-repository</artifactId>
<version>${alfresco.version}</version>
<scope>provided</scope>
<classifier>${alfresco.edition}</classifier>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</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</groupId>
<artifactId>recordsmanagement</artifactId> <version>2.1.0</version>
<type>amp</type> </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://${user.name}@domain.com/svn/trunk/</developerConnection>
<url>http://domain.com/svn/trunk/</url>
</scm>
<build>
<plugins>
<!– Needed for cross OS compatibility in acp/zip encoding –>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<configuration>
<encoding>UTF-8</encoding>
<!– By default as per http://code.google.com/p/maven-alfresco-archetypes/issues/detail?id=7 FTL are not filtered to avoid corruption.
| This behavior can be relaxed (in case filtering is needed in the FTLs) by selecting which files are filtered and which not as described
| here http://code.google.com/p/maven-alfresco-archetypes/issues/detail?id=7#c3
–>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>ftl</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
<plugin>
<artifactId>maven-nosnapshot-plugin</artifactId>
<groupId>org.alfresco.maven</groupId>
<version>0.0.8</version>
<executions>
<execution>
<id>default</id>
<phase>initialize</phase>
<goals>
<goal>strip</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<revisionOnScmFailure>1</revisionOnScmFailure>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.alfresco.maven.plugin</groupId>
<artifactId>maven-amp-plugin</artifactId>
<version>3.0.4</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.org.alfresco</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 <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>
</resource>
<!–
Copies and filters AMP config in the proper package
'alfresco/module/${project.artifactId}' so to enforce full module
naming single sourcing from POM properties
–>
<resource>
<filtering>true</filtering>
<directory>src/main/config</directory>
<targetPath>alfresco/module/${project.artifactId}</targetPath>
<excludes>
<exclude>**README-*</exclude>
</excludes>
</resource>
</resources>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<versionRange>[2.0,)</versionRange>
<goals>
<goal>copy-dependencies</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.alfresco.maven</groupId>
<artifactId>maven-nosnapshot-plugin</artifactId>
<versionRange>[0.0,)</versionRange>
<goals>
<goal>strip</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<!–
Profile used to trigger war creation and integration within Jetty
embedded
–>
<profile>
<id>webapp</id>
<build>
<filters>
<filter>${project.basedir}/src/test/properties/${env}/alfresco-global.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>${project.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>3.0.4</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>
<configuration>
<archiveClasses>true</archiveClasses>
</configuration>
</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>${project.build.directory}/${webapp.name}</webappDirectory>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
<warSourceExcludes>licenses/**</warSourceExcludes>
<webResources>
<resource>
<directory>${project.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>
<resource>
<directory>jetty</directory>
<targetPath>WEB-INF</targetPath>
<filtering>true</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
–>
<dependency>
<groupId>org.alfresco.maven.plugin</groupId>
<artifactId>maven-amp-plugin</artifactId>
<version>3.0.4</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.26</version>
<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>${project.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>
<dependencies>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
</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 alfresco-global.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>
</testResource>
<!–
src/main/config/ is copied into ==>
target/test-classes/alfresco/module/${project.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/${project.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>org.alfresco</groupId>
<artifactId>alfresco</artifactId>
<version>${alfresco.version}</version>
<type>war</type>
<classifier>${alfresco.edition}</classifier>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.158</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.2.7.ga</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>tk.skuro.alfresco</groupId>
<artifactId>h2-support</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
08-29-2012 06:34 AM
03-15-2013 02:32 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.