Share JAR Maven Archetype for SKD 3.0

This commit is contained in:
Martin Bergljung 2016-08-16 15:56:37 +01:00
parent 101a04e309
commit d46fa394e7
33 changed files with 306 additions and 611 deletions

View File

@ -0,0 +1,26 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
<id>build-amp-file</id>
<formats>
<format>amp</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<files>
<file>
<source>${project.basedir}/src/main/resources/alfresco/module/${project.artifactId}/module.properties</source>
<filtered>true</filtered>
</file>
</files>
<dependencySets>
<dependencySet>
<outputDirectory>lib</outputDirectory>
</dependencySet>
</dependencySets>
</assembly>

View File

@ -32,8 +32,9 @@
executing for example $ mvn clean install alfresco:run -->
<alfresco.groupId>org.alfresco</alfresco.groupId>
<alfresco.platform.war.artifactId>alfresco-platform</alfresco.platform.war.artifactId>
<alfresco.platform.version>5.1.g</alfresco.platform.version>
<alfresco.share.version>5.1.f</alfresco.share.version>
<!--4.2, 5.0, 5.1 artifact ID: <alfresco.platform.war.artifactId>alfresco</alfresco.platform.war.artifactId>-->
<alfresco.platform.version>5.2.a-EA</alfresco.platform.version>
<alfresco.share.version>5.1.g</alfresco.share.version>
<!-- Alfresco Repo Database configuration.
By default it uses a flat file H2 database to be able to run embedded.

View File

@ -9,33 +9,40 @@
<defaultValue>1.0-SNAPSHOT</defaultValue>
</requiredProperty>
</requiredProperties>
<fileSets>
<fileSet filtered="false" packaged="true" encoding="UTF-8">
<fileSet filtered="false" packaged="false" encoding="UTF-8">
<directory>src/main/assembly</directory>
<includes>
<include>**/*.xml</include>
</includes>
</fileSet>
<fileSet filtered="true" packaged="true" encoding="UTF-8">
<directory>src/main/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
<fileSet filtered="false" packaged="true" encoding="UTF-8">
<fileSet filtered="true" packaged="true" encoding="UTF-8">
<directory>src/test/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
<fileSet filtered="true" packaged="false" encoding="UTF-8">
<directory>src/main/amp/config/alfresco/web-extension</directory>
<directory>src/main/resources/alfresco/web-extension</directory>
<includes>
<include>__artifactId__-slingshot-application-context.xml</include>
</includes>
</fileSet>
<fileSet filtered="true" packaged="false" encoding="UTF-8">
<directory>src/main/amp/config/alfresco/web-extension/site-data/extensions</directory>
<directory>src/main/resources/alfresco/web-extension/site-data/extensions</directory>
<includes>
<include>__artifactId__-example-widgets.xml</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8" filtered="false">
<directory>src/main/amp</directory>
<directory>src/main/resources</directory>
<includes>
<include>**</include>
</includes>
@ -44,35 +51,19 @@
<exclude>**/__artifactId__-example-widgets.xml</exclude>
</excludes>
</fileSet>
<fileSet encoding="UTF-8" filtered="false">
<fileSet filtered="true" packaged="false" encoding="UTF-8">
<directory>src/test/resources</directory>
<includes>
<include>**</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8" filtered="false">
<directory>src/main/resources</directory>
<includes>
<include>**</include>
</includes>
</fileSet>
<fileSet filtered="false" encoding="UTF-8">
<directory>src/test/properties</directory>
<includes>
<include>**/*</include>
</includes>
</fileSet>
<fileSet filtered="false" encoding="UTF-8">
<directory>tomcat</directory>
<includes>
<include>**/*.xml</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8">
<directory></directory>
<includes>
<include>run.sh</include>
<include>run.bat</include>
<include>README.md</include>
</includes>
</fileSet>
</fileSets>

View File

@ -0,0 +1,33 @@
# Alfresco Share JAR Module - SDK 3
To run this module use `mvn clean install -DskipTests=true alfresco:run` or `./run.sh` and verify that it
* Runs the embedded Tomcat + H2 DB
* Runs Alfresco Share
* Packages both as JAR and AMP assembly
Note. You access Share as follows: http://localhost:8081/share
Note. You need an Alfresco Platform instance running at http://localhost:8080/alfresco that Share can talk to.
Typically you will just kick off a platform-jar module for that.
# Few things to notice
* No parent pom
* WAR assembly is handled by the Alfresco Maven Plugin configuration, if needed
* Standard JAR packaging and layout
* Works seamlessly with Eclipse and IntelliJ IDEA
* JRebel for hot reloading, JRebel maven plugin for generating rebel.xml, agent usage: `MAVEN_OPTS=-Xms256m -Xmx1G -agentpath:/home/martin/apps/jrebel/lib/libjrebel64.so`
* AMP as an assembly
* [Configurable Run mojo](https://github.com/Alfresco/alfresco-sdk/blob/sdk-3.0/plugins/alfresco-maven-plugin/src/main/java/org/alfresco/maven/plugin/RunMojo.java) in the `alfresco-maven-plugin`
* No unit testing/functional tests just yet
* Resources loaded from META-INF
* Web Fragment (this includes a sample servlet configured via web fragment)
# TODO
* Abstract assembly into a dependency so we don't have to ship the assembly in the archetype

View File

@ -5,106 +5,168 @@
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
<name>${artifactId} AMP project</name>
<packaging>amp</packaging>
<description>Manages the lifecycle of the ${artifactId} AMP (Alfresco Module Package)</description>
<name>${artifactId} Share Jar Module - SDK 3</name>
<description>Share JAR Module (to be included in the share.war) - SDK 3</description>
<packaging>jar</packaging>
<parent>
<groupId>org.alfresco.maven</groupId>
<artifactId>alfresco-sdk-parent</artifactId>
<version>@@alfresco.sdk.parent.version@@</version>
</parent>
<!--
SDK properties have sensible defaults in the SDK parent,
but you can override the properties below to use another version.
For more available properties see the alfresco-sdk-parent POM.
-->
<properties>
<!-- The following are default values for data location and Alfresco version.
Uncomment if you need to change
<alfresco.version>${alfresco.community.default.version}</alfresco.version> -->
<alfresco.sdk.version>3.0.0-SNAPSHOT</alfresco.sdk.version>
<!-- This control the root logging level for all apps uncomment and change, defaults to WARN
<app.log.root.level>WARN</app.log.root.level>
-->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Set the enviroment to use, this controls which properties will be picked in src/test/properties
for embedded run, defaults to the 'local' environment. See SDK Parent POM for more info.
<env>other environment name</env>
-->
<!-- Alfresco webapp artifacts and versions, these are the webapps that will be deployed
and run by the tomcat maven plugin when executing $ mvn .... alfresco:run -->
<alfresco.groupId>org.alfresco</alfresco.groupId>
<alfresco.share.war.artifactId>share</alfresco.share.war.artifactId>
<alfresco.share.version>5.1.g</alfresco.share.version>
<alfresco.surf.version>6.3</alfresco.surf.version>
<!-- The Maven artifact ID to use when loading the Share.WAR that the AMP should be applied to,
defaults to the alfresco.war artifact ID, so we need to override here. -->
<app.amp.client.war.artifactId>${alfresco.share.artifactId}</app.amp.client.war.artifactId>
<!-- Since Alfresco.WAR (i.e. the Repository) is already running on port 8080, we run Share.WAR on port 8081 -->
<!-- Since alfresco.war (i.e. the Platform/Repository) is already running on port 8080, we run Share.WAR on port 8081.
If Alfresco Platform is not running, then generate a platform-jar-module and start it up. -->
<maven.tomcat.port>8081</maven.tomcat.port>
<!-- Used in share-config-custom.xml. By default points to local installation of Alfresco Repo -->
<alfresco.repo.url>http://localhost:8080/alfresco</alfresco.repo.url>
<!-- JRebel Hot reloading of classpath stuff and web resource stuff -->
<jrebel.version>1.1.6</jrebel.version>
</properties>
<!-- Here we realize the connection with the Alfresco selected platform
(e.g.version and edition) -->
<dependencyManagement>
<dependencies>
<!-- This will import the dependencyManagement for all artifacts in the selected Alfresco version/edition
(see http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Importing_Dependencies)
NOTE: You still need to define dependencies in your POM, but you can omit version as it's enforced by this dependencyManagement. NOTE: It defaults
to the latest version this SDK pom has been tested with, but alfresco version can/should be overridden in your project's pom -->
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco-platform-distribution</artifactId>
<version>${alfresco.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<!-- Following dependencies are needed for compiling Java code in src/main/java; -->
<dependencies>
<!-- Following dependencies are needed for compiling Java code in src/main/java -->
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>share</artifactId>
<version>${alfresco.version}</version>
<artifactId>${alfresco.share.war.artifactId}</artifactId>
<version>${alfresco.share.version}</version>
<classifier>classes</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.extensions.surf</groupId>
<groupId>org.alfresco.surf</groupId>
<artifactId>spring-surf-api</artifactId>
<version>${alfresco.surf.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Compress JavaScript files and store as *-min.js -->
<!--
The Alfresco Maven Plugin contains all the logic to run the extension
in an embedded Tomcat with the H2 database.
-->
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<groupId>org.alfresco.maven.plugin</groupId>
<artifactId>alfresco-maven-plugin</artifactId>
<version>${alfresco.sdk.version}</version>
<configuration>
<!-- We assume that the platform/repository is already running on localhost:8080 -->
<enableH2>false</enableH2>
<enablePlatform>false</enablePlatform>
<enableSolr>false</enableSolr>
<!-- Enable the Share webapp, which is what we customize with Share JAR modules -->
<enableShare>true</enableShare>
</configuration>
</plugin>
<!-- Build an AMP if 3rd party libs are needed by the extension -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>build-amp-file</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptor>src/main/assembly/amp.xml</descriptor>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.alfresco.maven.plugin</groupId>
<artifactId>alfresco-maven-plugin</artifactId>
<version>${alfresco.sdk.version}</version>
</dependency>
</dependencies>
</plugin>
<!-- Hot reloading with JRebel -->
<plugin>
<groupId>org.zeroturnaround</groupId>
<artifactId>jrebel-maven-plugin</artifactId>
<version>${jrebel.version}</version>
<executions>
<execution>
<id>generate-rebel-xml</id>
<phase>process-resources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<!--
addResourcesDirToRebelXml - default is false
Required if the resource directories are to be added to rebel.xml
-->
<addResourcesDirToRebelXml>true</addResourcesDirToRebelXml>
<!-- Always generate the rebel.xml file no matter what timestamps -->
<alwaysGenerate>true</alwaysGenerate>
</configuration>
</plugin>
</plugins>
<resources>
<!-- Filter the resource files in this project and do property substitutions -->
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<testResources>
<!-- Filter the test resource files in this project and do property substitutions -->
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
</build>
<profiles>
<!--
Brings in the extra Enterprise specific share classes,
if the 'enterprise' profile has been activated, needs to be activated manually. -->
<profile>
<id>enterprise</id>
<dependencies>
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>share-enterprise</artifactId>
<version>${alfresco.version}</version>
<classifier>classes</classifier>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
</profiles>
<!--
Alfresco Maven Repositories
-->
<repositories>
<repository>
<id>alfresco-public</id>
<url>https://artifacts.alfresco.com/nexus/content/groups/public</url>
</repository>
<repository>
<id>alfresco-public-snapshots</id>
<url>https://artifacts.alfresco.com/nexus/content/groups/public-snapshots</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>alfresco-plugin-public</id>
<url>https://artifacts.alfresco.com/nexus/content/groups/public</url>
</pluginRepository>
<pluginRepository>
<id>alfresco-plugin-public-snapshots</id>
<url>https://artifacts.alfresco.com/nexus/content/groups/public-snapshots</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>

View File

@ -1,20 +1,9 @@
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Dev environment startup script for Alfresco Community. ::
:: ::
:: Downloads the spring-loaded lib if not existing and ::
:: runs the Share AMP applied to Share WAR. ::
:: Note. requires Alfresco.war to be running in another ::
:: Tomcat on port 8080. ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
set springloadedfile=%HOME%\.m2\repository\org\springframework\springloaded\@@springloaded.version@@\springloaded-@@springloaded.version@@.jar
if not exist %springloadedfile% (
mvn validate -Psetup
)
set MAVEN_OPTS=-javaagent:"%springloadedfile%" -noverify
mvn integration-test -Pamp-to-war -nsu
:: mvn integration-test -Pamp-to-war
mvn clean install -DskipTests=true alfresco:run

View File

@ -1,10 +1,4 @@
#!/bin/bash
# Downloads the spring-loaded lib if not existing and runs the Share AMP applied to Share WAR
# Note. requires Alfresco.war to be running in another Tomcat on port 8080
springloadedfile=~/.m2/repository/org/springframework/springloaded/@@springloaded.version@@/springloaded-@@springloaded.version@@.jar
if [ ! -f $springloadedfile ]; then
mvn validate -Psetup
fi
MAVEN_OPTS="-javaagent:$springloadedfile -noverify" mvn integration-test -Pamp-to-war
mvn clean install -DskipTests=true alfresco:run

View File

@ -1,29 +0,0 @@
#set($symbol_pound='#')
#set($symbol_dollar='$')
#set($symbol_escape='\' )
<?xml version='1.0' encoding='UTF-8'?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<!--
Define beans related to this Share extension here, such as
evaluators and resource bootstrapping.
Note. Any configuration related to the whole Share.war webapp
(i.e. not specific to this share extension) should be
placed in the tomcat/shared/classes/alfresco/web-extension/custom-slingshot-application-context.xml file
-->
<!-- Add module specific messages and labels -->
<bean id="${package}.${artifactId}.resources"
class="org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent">
<property name="resourceBundles">
<list>
<value>alfresco.web-extension.messages.${artifactId}</value>
</list>
</property>
</bean>
</beans>

View File

@ -1,27 +0,0 @@
model.jsonModel = {
widgets: [{
id: "SET_PAGE_TITLE",
name: "alfresco/header/SetTitle",
config: {
title: "This is a simple page"
}
},
{
id: "MY_HORIZONTAL_WIDGET_LAYOUT",
name: "alfresco/layout/HorizontalWidgets",
config: {
widgetWidth: 50,
widgets: [
{
name: "alfresco/logo/Logo",
config: {
logoClasses: "alfresco-logo-only"
}
},
{
name: "example/widgets/TemplateWidget"
}
]
}
}]
};

View File

@ -1,14 +0,0 @@
# Custom AMP to WAR location mappings
#
# The following property can be used to include the standard set of mappings.
# The contents of this file will override any defaults. The default is
# 'true', i.e. the default mappings will be augmented or modified by values in
# this file.
#
include.default=true
#
# Custom mappings. If 'include.default' is false, then this is the complete set.
#
/web=/

View File

@ -0,0 +1,26 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
<id>build-amp-file</id>
<formats>
<format>amp</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<files>
<file>
<source>${project.basedir}/src/main/resources/alfresco/module/${project.artifactId}/module.properties</source>
<filtered>true</filtered>
</file>
</files>
<dependencySets>
<dependencySet>
<outputDirectory>lib</outputDirectory>
</dependencySet>
</dependencySets>
</assembly>

View File

@ -1,6 +0,0 @@
<html>
<body>
<p>This is a test web resource loaded from the JAR/META-INF/resources.
This, per Servlet 3 spec is mapped to the root of the webapp</p>
</body>
</html>

View File

@ -6,7 +6,7 @@
Note. Any configuration related to the whole Share.war webapp
(i.e. not specific to this share extension) should be
placed in the environment specific config:
alfresco/tomcat/shared/classes/alfresco/web-extension/share-config-custom.xml file
allinone/share-war/src/main/resources/alfresco/web-extension/share-config-custom.xml file
-->
<alfresco-config>

View File

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

View File

@ -0,0 +1,29 @@
#set($symbol_pound='#')
#set($symbol_dollar='$')
#set($symbol_escape='\' )
<?xml version='1.0' encoding='UTF-8'?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<!--
Define beans related to this Share extension here, such as
evaluators and resource bootstrapping.
Note. Any configuration related to the whole Share.war webapp
(i.e. not specific to this share extension) should be
placed in the alfresco-allinone/share/src/main/resources/alfresco/web-extension/custom-slingshot-application-context.xml file
-->
<!-- Add module specific messages and labels -->
<bean id="${package}.${artifactId}.resources"
class="org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent">
<property name="resourceBundles">
<list>
<value>alfresco.web-extension.messages.${artifactId}</value>
</list>
</property>
</bean>
</beans>

View File

@ -12,7 +12,7 @@
<web-framework>
<dojo-pages>
<packages>
<package name="example" location="js/example"/>
<package name="tutorials" location="resources/${artifactId}/js/tutorials"/>
</packages>
</dojo-pages>
</web-framework>

View File

@ -0,0 +1,29 @@
model.jsonModel = {
widgets: [{
id: "SET_PAGE_TITLE",
name: "alfresco/header/SetTitle",
config: {
title: "This is a sample HELLO page"
}
},
{
id: "MY_HORIZONTAL_WIDGET_LAYOUT",
name: "alfresco/layout/HorizontalWidgets",
config: {
widgetWidth: 50,
widgets: [
{
id: "DEMO_SIMPLE_LOGO",
name: "alfresco/logo/Logo",
config: {
logoClasses: "alfresco-logo-only"
}
},
{
id: "DEMO_SIMPLE_MSG",
name: "tutorials/widgets/TemplateWidget"
}
]
}
}]
};

View File

@ -1,62 +0,0 @@
------
Share AMP Archetype Advanced Usage
------
Gabriele Columbro
------
Aug 2014
------
AMP Unit Testing
Unit test your AMP customization is as easy as adding your tests in <<<src/test/java>>>. The current module in development
will be added to the test classpath together with all necessary Alfresco Spring contexts.
Running <<<mvn test>>> will results in your unit tests to be run. You can skip this (<<<not recommended>>>)
adding <<<-DskipTests>>> to your command line.
Share AMP Archetype properties
In the AMP archetype (as in the whole Part of the Alfresco SDK\x99) properties are configurable at many levels:
* as POM properties
* direclty in *.properties, particularly
* <<<src/main/amp/module.properties>>> (filtered and packaged in the AMP)
* <<<src/test/properties/<env>/alfresco-global.properties>>> (environment dependent properties for WAR run embedded)
* Common properties
Archetype behavior can mostly be controlled directly in the POM, via common properties provided by the parent POM.
See {{{../../poms/alfresco-sdk-parent/sdk-properties.html} SDK properties reference}} for details.
* AMP specific properties
In addition to the common properties, the following properties are specific of the AMP archetype. You can change
these properties to select a different WAR to install your AMP to (e.g. a pre-customized Alfresco or Share instance):
+---+
<project>
...
<properties>
<!--
Determines the coordinates of target WAR for this AMP
Allowed values: alfresco (default) | share
-->
<alfresco.client.war>alfresco</alfresco.client.war>
<alfresco.client.war.groupId>${alfresco.groupId}</alfresco.client.war.groupId>
<alfresco.client.war.version>${alfresco.version}</alfresco.client.war.version>
</properties>
...
</project>
+---+
Parent POM and behavior customization
To customize the behavior of your project, check out full set of the properties and plugin configurations defined in the
{{{../../poms/alfresco-sdk-parent/index.html}single entry point parent POM}}.
One quick way to do that is to use the <<<maven-help-plugin:effective-pom>>> to analyze your POM at runtime.

View File

@ -1,52 +0,0 @@
------
Building AMPs (Alfresco Module Packages) with Maven
------
Gabriele Columbro
------
Aug 2014
------
Introduction
The Share AMP Archetype is a sample fully featured project to manage AMP (Alfresco Module Package) projects for Alfresco Share.
This archetype can be used for Alfresco Share. For Alfresco Repository AMPs, please refer to the {{{../alfresco-amp-archetype/index.html}Alfresco AMP archetype}}
* Features
Amongst other features, this archetype provides support for:
* <<<amp>>> packaging support for your projects
* AMP dependency management in Maven
* Installation of AMPs in the Share WAR
* AMP Unit Testing support. Just run the standard <<<mvn test>>> and see your <<<src/test/java>>> Alfresco unit tests run.
An sample Unit Test is provided in this archetype.
* Embedded run in Tomcat and embedded H2 database for demo purposes, rapid application development and integration testing. Share runs on port 8081 by default, but you can control
this setting with the <<<maven.tomcat.port>>> pom property.
(<<NOTE>>: this is not a {{{http://www.alfresco.com/services/subscription/supported-platforms/} supported stack}} so use <<only for development purposes>>)
How to create a project:
You can create the latest release archetype with the following command:
+---+
mvn archetype:generate -DarchetypeCatalog=https://artifacts.alfresco.com/nexus/content/groups/public/archetype-catalog.xml -Dfilter=org.alfresco.maven.archetype:
+---+
You should then:
[[1]] Select the <<<share-amp-archetype>>> option
[[2]] Specify the <<<groupId>>> and <<<artifactId>>> for the project you want to create
[[3]] (<Optionally>) Select Alfresco Version / Edition (current default is: Alfresco Community 5.0.c)
You can find new Share AMP project ready to go in the <<<artifactId>>> folder.
Usage
Instructions on how to use the Share AMP archetype can be found on the {{{./usage.html}usage page}}, while
for more advanced use cases refer to the {{{./advanced-usage.html}advanced usage page}}

View File

@ -1,73 +0,0 @@
------
Share AMP Archetype Usage
------
Gabriele Columbro
------
Nov 2012
------
Prerequisites
See {{{../../prerequisites.html}SDK Pre-Requisites}} to successfully run this archetype.
Project layout
The archetype generated project should look like:
+---+
pom.xml
src/main/amp
|-> module.properties
|-> file-mapping.properties (optional)
|-> config/
|-> web/
|-> licenses/
src/main/java //Java classes to be packaged in the AMP embedded JAR)
src/main/resources //resources to the packaged in the AMP embedded JAR
src/main/resources/META-INF/resource //resources to the packaged in the AMP embedded JAR/META-INF and automatically mapped to the root of the webapp
src/test/java // Unit tests
src/test/resources // Unit test resources
src/test/properties/<env> // Environment aware alfresco-global.properties. By default <env>=local
+---+
Basically by default the folder <<<src/main/amp>>> maps the {{{https://wiki.alfresco.com/wiki/AMP_Files#The_structure_of_an_AMP_file}AMP structure}} and it's where you can build your module.
Usage
This project manages an AMP and provides support for typical development lifecycle use cases like:
* packaging
* rapid development
* testing (unit and integration)
* run embedded
* integration testing
* release and distribution of your AMP artifact.
The AMPs produced with this project are fully compatible with Alfresco MMT, in fact the Maven Alfresco plugin used to manage AMPs in this SDK embeds the official Alfresco MMT to install depdended AMPs.
Commands
Common AMP project lifecycle commands you want to run are:
* <<<mvn package>>>: Runs unit tests and packages AMP in <<<$\{project.build.directory\}/$\{project.build.finalName\}.amp>>>
* <<<mvn install>>>: Like <<<mvn package>>> but also installs AMP in local Maven repository to be depended upon
* <<<mvn install -Dmaven.test.skip=true>>>: Like <<<mvn install>>> but skips unit tests
* <<<mvn install -Pamp-to-war>>> Like <<<mvn package -Pamp-to-war>>>
but also installs and runs the resulting WAR+AMP in Tomcat + H2 embedded from running and development.
This also enables rapid application development features, like hot reloading and remote JUnit running.
When you run this command then you can access in your browser <<< {{{http://localhost:8081/share}}} >>>.
* <<<mvn clean -Ppurge>>>: Removes DB, alf_data, indexes and log files. Useful to purge the development repo (by default self contained in <<<$\{project.basedir\}/alf_data_dev>>>

View File

@ -1,51 +0,0 @@
<project>
<body>
<!--<menu ref="parent" inherit="bottom"/>-->
<head>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '${gaTrackingId}']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<menu name="Share AMP Archetype">
<item name="Introduction" href="index.html"/>
<item name="Usage" href="usage.html"/>
<item name="Advanced Usage" href="advanced-usage.html"/>
</menu>
<menu name="SDK components">
<item name="Maven Alfresco SDK" href="../../index.html" />
<item name="Alfresco AMP Archetype" href="../alfresco-amp-archetype/index.html" />
<item name="Share AMP Archetype" href="./index.html" />
<item name="Alfresco All-in-One Archetype" href="../alfresco-allinone-archetype/index.html" />
<item name="Maven Alfresco SDK Parent POM" href="../../poms/alfresco-sdk-parent/index.html" />
<item name="Alfresco Platform Distribution POM" href="https://artifacts.alfresco.com/nexus/content/repositories/alfresco-docs/alfresco-platform-distribution/latest/index.html" />
<item name="Maven Alfresco Plugin" href="../../plugins/alfresco-maven-plugin/index.html" />
</menu>
<menu name="Alfresco Community">
<item name="Official Maven Alfresco SDK docs" href="http://docs.alfresco.com/community/concepts/alfresco-sdk-intro.html" />
<item name="Maven Alfresco Wiki Documentation" href="http://wiki.alfresco.com/wiki/Maven_Alfresco_SDK" />
<item name="Alfresco with Maven for Dummies" href="https://wiki.alfresco.com/wiki/Maven_For_Dummies" />
<item name="Developer Access (Google Code)" href="http://code.google.com/p/maven-alfresco-archetypes/" />
<item name="Gabriele Columbro's blog" href="http://www.mindthegab.com/" />
<item name="Maurizio Pillitu's blog" href="http://www.session.it/" />
<item name="Carlo Sciolla's blog" href="http://skuro.tk/" />
<item name="Enterprise adoption" href="http://www.slideshare.net/guest67a9ba/maven-application-lifecycle-management-for-alfresco" />
</menu>
<!-- maybe it's inherited? -->
<!--<menu ref="reports"/>-->
</body>
</project>

View File

@ -1,92 +0,0 @@
<alfresco-config>
<config evaluator="string-compare" condition="WebFramework">
<web-framework>
<autowire>
<!-- Changing this to 'development' currently breaks the Admin Console.
Instead we make a POST to clear Share dependency caches, see 'clear-caches-refresh-ws' profile. -->
<mode>production</mode> <!-- not really need in the long run, used for YUI - deprecate -->
</autowire>
<!--
We don't need to do this when we have the new refresh mojos in the Alfresco plug-in.
If resource caching has been disabled then all the dependency caches will be cleared
before processing the Aikau jsonModel request...
(i.e. this.dojoDependencyHandler.clearCaches() )
For more information see the Aikau source code: https://github.com/Alfresco/Aikau
-->
<disable-resource-caching>false</disable-resource-caching>
</web-framework>
</config>
<!-- Global config section -->
<config replace="true">
<flags>
<!--
Developer debugging setting to turn on DEBUG mode for client scripts in the browser
-->
<client-debug>true</client-debug>
<!--
LOGGING can always be toggled at runtime when in DEBUG mode (Ctrl, Ctrl, Shift, Shift).
This flag automatically activates logging on page load.
-->
<client-debug-autologging>false</client-debug-autologging>
</flags>
</config>
<!--
Disable CSRF completely for now
It seems Share has issues on 4.2.x with the embedded tomcat and CSRFPolicy
-->
<config evaluator="string-compare" condition="CSRFPolicy" replace="true">
<filter/>
</config>
<!--
Change so it is picked up from property where the Alfresco Repo Webapp is running
(e.g. http://localhost:8080/alfresco)
-->
<config evaluator="string-compare" condition="Remote">
<remote>
<endpoint>
<id>alfresco-noauth</id>
<name>Alfresco - unauthenticated access</name>
<description>Access to Alfresco Repository WebScripts that do not require authentication</description>
<connector-id>alfresco</connector-id>
<endpoint-url>${alfresco.repo.url}/s</endpoint-url>
<identity>none</identity>
</endpoint>
<endpoint>
<id>alfresco</id>
<name>Alfresco - user access</name>
<description>Access to Alfresco Repository WebScripts that require user authentication</description>
<connector-id>alfresco</connector-id>
<endpoint-url>${alfresco.repo.url}/s</endpoint-url>
<identity>user</identity>
</endpoint>
<endpoint>
<id>alfresco-feed</id>
<name>Alfresco Feed</name>
<description>Alfresco Feed - supports basic HTTP authentication via the EndPointProxyServlet</description>
<connector-id>http</connector-id>
<endpoint-url>${alfresco.repo.url}/s</endpoint-url>
<basic-auth>true</basic-auth>
<identity>user</identity>
</endpoint>
<endpoint>
<id>activiti-admin</id>
<name>Activiti Admin UI - user access</name>
<description>Access to Activiti Admin UI, that requires user authentication</description>
<connector-id>activiti-admin-connector</connector-id>
<endpoint-url>${alfresco.repo.url}/activiti-admin</endpoint-url>
<identity>user</identity>
</endpoint>
</remote>
</config>
</alfresco-config>

View File

@ -1,52 +0,0 @@
# This file is copied from Alfresco Share 5.0.d
# Overrides tomcat/webapps/share/WEB-INF/classes/log4j,properties
# and sets new file location from property and log level from property.
#
# Set root logger level to error
log4j.rootLogger=${app.log.root.level}, Console, File
###### Console appender definition #######
# All outputs currently set to be a ConsoleAppender.
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
# use log4j NDC to replace %x with tenant domain / username
log4j.appender.Console.layout.ConversionPattern=%d{ISO8601} %x %-5p [%c{3}] [%t] %m%n
#log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c] %m%n
###### File appender definition #######
log4j.appender.File=org.apache.log4j.DailyRollingFileAppender
log4j.appender.File.File=${app.log.dir}alfresco.log
log4j.appender.File.Append=true
log4j.appender.File.DatePattern='.'yyyy-MM-dd
log4j.appender.File.layout=org.apache.log4j.PatternLayout
log4j.appender.File.layout.ConversionPattern=%d{yyyy-MM-dd} %d{ABSOLUTE} %-5p [%c] [%t] %m%n
# Spring
log4j.logger.org.springframework=warn
# Turn off Spring remoting warnings that should really be info or debug.
log4j.logger.org.springframework.remoting.support=error
log4j.logger.org.springframework.util=error
# MyFaces
log4j.logger.org.apache.myfaces.util.DebugUtils=info
log4j.logger.org.apache.myfaces.el.VariableResolverImpl=error
log4j.logger.org.apache.myfaces.application.jsp.JspViewHandlerImpl=error
log4j.logger.org.apache.myfaces.taglib=error
# Alfresco
log4j.logger.org.alfresco=error
log4j.logger.org.alfresco.config=warn
log4j.logger.org.alfresco.config.JndiObjectFactoryBean=warn
log4j.logger.org.alfresco.web=info
# Web Framework
log4j.logger.org.springframework.extensions.webscripts=info
log4j.logger.org.springframework.extensions.webscripts.ScriptLogger=warn
log4j.logger.org.springframework.extensions.webscripts.ScriptDebugger=off
# Freemarker
# Note the freemarker.runtime logger is used to log non-fatal errors that are handled by Alfresco's retrying transaction handler
log4j.logger.freemarker.runtime=

View File

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- ===================================================================================================================
This context file is used only in a development IDE for rapid development,
it is never released with the Alfresco.war
=================================================================================================================-->
<!-- Setup docBase to something like share-amp/target/share-amp-war
and path to /share -->
<Context docBase="${app.amp.client.war.folder}" path="${share.client.contextPath}">
<Resources className="org.apache.naming.resources.VirtualDirContext"
extraResourcePaths="/=${project.build.directory}/${project.build.finalName}/web" />
<!-- Configure where the Share (share.war) web application can load classes, test classes, and config -->
<!-- Setup the virtual class path like this:
1) target/classes
2) target/${project.build.finalName}/config
3) target/test-classes
This way mvn compile can be invoked and all changes will be picked up
-->
<Loader searchVirtualFirst="true"
className="org.apache.catalina.loader.VirtualWebappLoader"
virtualClasspath="${project.build.outputDirectory};${project.build.directory}/${project.build.finalName}/config;${project.build.testOutputDirectory}" />
<!-- This enables hot reloading of web resources from uncompressed jars (while in prod they would be loaded from WEB-INF/lib/{\*.jar}/META-INF/resources -->
<JarScanner scanAllDirectories="true" />
</Context>