mirror of
https://github.com/Alfresco/alfresco-sdk.git
synced 2025-05-19 17:15:24 +00:00
Issue #197:
- enabled rad functionalities on share archetype - added basic Ole's sample for Aikau widget - added new configuration property to the AmpMojo to allow NOT including /web resources in the AMP. This allows the -Pamp-to-war profile to exclude /web from AMP packaging and load directly web resources from the virtualWebapp Resources tag in context.xml (differently from Loader, if you have web resources twice, the webapp one takes precedence) - configured and tested amp-to-war to reload share web resources - added src/test/resources/alfresco/web-extension/share-config-custom.xml to enable dev mode just in test
This commit is contained in:
parent
a37e89f34b
commit
b55d13b0d0
@ -1,6 +1,3 @@
|
||||
#set( $symbol_pound = '#' )
|
||||
#set( $symbol_dollar = '$' )
|
||||
#set( $symbol_escape = '\' )
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
@ -16,4 +13,5 @@
|
||||
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.
|
||||
-->
|
||||
-->
|
||||
This is a demo JSP. When running with -Pamp-to-war, just change this text and it will be automatically reloaded!
|
@ -35,7 +35,7 @@
|
||||
<fileSet filtered="false" encoding="UTF-8">
|
||||
<directory>src/main/amp</directory>
|
||||
<includes>
|
||||
<include>**/*.jsp</include>
|
||||
<include>**/*</include>
|
||||
<include>**/*.xml</include>
|
||||
<include>**/*.properties</include>
|
||||
<include>**/*.txt</include>
|
||||
@ -54,20 +54,20 @@
|
||||
<include>**/*.css</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
<fileSet filtered="true" encoding="UTF-8">
|
||||
<fileSet filtered="false" encoding="UTF-8">
|
||||
<directory>src/main/amp/config/alfresco/module/__artifactId__</directory>
|
||||
</fileSet>
|
||||
|
||||
<fileSet filtered="true" encoding="UTF-8">
|
||||
<fileSet filtered="false" encoding="UTF-8">
|
||||
<directory>src/main/amp/web</directory>
|
||||
</fileSet>
|
||||
<fileSet filtered="true" encoding="UTF-8">
|
||||
<fileSet filtered="false" encoding="UTF-8">
|
||||
<directory>src/main/amp/web/themes</directory>
|
||||
</fileSet>
|
||||
<fileSet filtered="true" encoding="UTF-8">
|
||||
<fileSet filtered="false" encoding="UTF-8">
|
||||
<directory>src/main/amp/web/js</directory>
|
||||
</fileSet>
|
||||
<fileSet filtered="true" encoding="UTF-8">
|
||||
<fileSet filtered="false" encoding="UTF-8">
|
||||
<directory>src/main/amp/web/components</directory>
|
||||
</fileSet>
|
||||
|
||||
@ -80,7 +80,7 @@
|
||||
<fileSet filtered="false" encoding="UTF-8">
|
||||
<directory>src/test/resources</directory>
|
||||
<includes>
|
||||
<include>**/*.properties</include>
|
||||
<include>**/*</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
<fileSet filtered="false" encoding="UTF-8">
|
||||
|
@ -21,30 +21,24 @@
|
||||
| For more available properties see the alfresco-sdk-parent POM.
|
||||
-->
|
||||
<properties>
|
||||
<!--
|
||||
| Defines the groupId for the Alfresco Artifacts to work against. As of 4.2 the only allowed value is: org.alfresco
|
||||
| NOTE: See http://docs.alfresco.com/4.2/concepts/dev-extensions-maven-sdk-tutorials-alfresco-enterprise.html for details
|
||||
-->
|
||||
<alfresco.groupId>${alfresco_target_groupId}</alfresco.groupId>
|
||||
<!-- Defines the target WAR artifactId to run this amp, only used with the -Pamp-to-war switch
|
||||
| Allowed values: alfresco | share. In this case it's configured to use OOTB share -->
|
||||
<alfresco.client.war>share</alfresco.client.war>
|
||||
|
||||
<!-- Since Alfresco is already running on port 8080, we run Share on port 8081 -->
|
||||
<maven.tomcat.port>8081</maven.tomcat.port>
|
||||
|
||||
<!-- Used in share-config-custom.xml. By default points to standard location of Alfresco -->
|
||||
<alfresco.repo.url>http://localhost:8080/alfresco</alfresco.repo.url>
|
||||
|
||||
<!-- Defines the Alfresco version to work against.
|
||||
Community versions are typically identified by major.minor.character (4.2.a) while Enterprise versions are identified by major.minor.digit (4.2.0)
|
||||
Community versions are typically identified by major.minor.character (4.2.a),
|
||||
while Enterprise versions are identified by major.minor.digit (4.2.0)
|
||||
-->
|
||||
<alfresco.version>${alfresco_target_version}</alfresco.version>
|
||||
<!-- Defines the log level used in log4j.properties -->
|
||||
<app.log.root.level>WARN</app.log.root.level>
|
||||
<alfresco.data.location>alf_data_dev</alfresco.data.location>
|
||||
<!-- Defines the target WAR artifactId to run this amp, only used with the -Pamp-to-war switch
|
||||
. | Allowed values: alfresco | share. Defaults to a repository AMP, but could point to your foundation WAR -->
|
||||
<alfresco.client.war>${alfresco_target_amp_client_war}</alfresco.client.war>
|
||||
<!-- Defines the target WAR groupId to run this amp, only used with the -Pamp-to-war switch
|
||||
. | Could be org.alfresco | org.alfresco.enterprise or your corporate groupId -->
|
||||
<alfresco.client.war.groupId>${alfresco_target_amp_client_war_groupId}</alfresco.client.war.groupId>
|
||||
<!-- Defines the target WAR version to run this amp, only used with the -Pamp-to-war switch -->
|
||||
<alfresco.client.war.version>${alfresco_target_amp_client_war_version}</alfresco.client.war.version>
|
||||
<!-- This controls which properties will be picked in src/test/properties for embedded run -->
|
||||
<env>local</env>
|
||||
|
||||
<!-- Tell Tomcat to run on port 8081 since this is a standalone project, and likely Alfresco will have taken port 8080 -->
|
||||
<maven.tomcat.port>8081</maven.tomcat.port>
|
||||
|
||||
</properties>
|
||||
|
||||
<!-- Here we realize the connection with the Alfresco selected platform
|
||||
@ -79,13 +73,6 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Test dependencies -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.8.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<!-- This repository is only needed to retrieve Alfresco parent POM.
|
||||
|
@ -0,0 +1,6 @@
|
||||
<webscript>
|
||||
<shortname>Simple Page</shortname>
|
||||
<description>Simple page definition</description>
|
||||
<family>Share</family>
|
||||
<url>/simple-page</url>
|
||||
</webscript>
|
@ -0,0 +1 @@
|
||||
<@processJsonModel group="share"/>
|
@ -0,0 +1,27 @@
|
||||
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"
|
||||
}
|
||||
]
|
||||
}
|
||||
}]
|
||||
};
|
@ -0,0 +1,20 @@
|
||||
<extension>
|
||||
<modules>
|
||||
<module>
|
||||
<id>Example Aikau Widgets</id>
|
||||
<version>1.0</version>
|
||||
<auto-deploy>true</auto-deploy>
|
||||
<configurations>
|
||||
<config evaluator="string-compare" condition="WebFramework" replace="false">
|
||||
<web-framework>
|
||||
<dojo-pages>
|
||||
<packages>
|
||||
<package name="example" location="js/example"/>
|
||||
</packages>
|
||||
</dojo-pages>
|
||||
</web-framework>
|
||||
</config>
|
||||
</configurations>
|
||||
</module>
|
||||
</modules>
|
||||
</extension>
|
@ -0,0 +1,20 @@
|
||||
define(["dojo/_base/declare",
|
||||
"dijit/_WidgetBase",
|
||||
"alfresco/core/Core",
|
||||
"dijit/_TemplatedMixin",
|
||||
"dojo/text!./templates/TemplateWidget.html"
|
||||
],
|
||||
function(declare, _Widget, Core, _Templated, template) {
|
||||
return declare([_Widget, Core, _Templated], {
|
||||
templateString: template,
|
||||
i18nRequirements: [ {i18nFile: "./i18n/TemplateWidget.properties"} ],
|
||||
cssRequirements: [{cssFile:"./css/TemplateWidget.css"}],
|
||||
|
||||
buildRendering: function example_widgets_TemplateWidget__buildRendering() {
|
||||
this.greeting = this.message('hello-label');
|
||||
|
||||
this.inherited(arguments);
|
||||
|
||||
}
|
||||
});
|
||||
});
|
@ -0,0 +1,5 @@
|
||||
.my-template-widget {
|
||||
border: 1px #000000 solid;
|
||||
padding: 1em;
|
||||
width: 100px;
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
hello-label=Hello from i18n!
|
||||
hello-test=New label!
|
@ -0,0 +1 @@
|
||||
<div class="my-template-widget">${greeting}</div>
|
@ -0,0 +1,74 @@
|
||||
<alfresco-config>
|
||||
|
||||
<config evaluator="string-compare" condition="WebFramework">
|
||||
<web-framework>
|
||||
<autowire>
|
||||
<mode>development</mode>
|
||||
</autowire>
|
||||
</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>
|
||||
|
||||
<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>
|
||||
|
@ -1,5 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Context docBase="${alfresco.client.war.folder}" path="${alfresco.client.contextPath}">
|
||||
|
||||
|
||||
<Resources className="org.apache.naming.resources.VirtualDirContext"
|
||||
extraResourcePaths="/=${project.build.directory}/${project.build.finalName}/web" />
|
||||
|
||||
|
||||
<Loader searchVirtualFirst="true" className="org.apache.catalina.loader.VirtualWebappLoader"
|
||||
virtualClasspath="${project.build.outputDirectory};${project.build.testOutputDirectory}" />
|
||||
|
||||
<!--
|
||||
<Environment override="false" type="java.lang.Boolean" name="properties/startup.enable" description="A flag that globally enables or disables startup of the major Alfresco subsystems." value="true"/>
|
||||
<Environment override="false" type="java.lang.String" name="properties/dir.root" description="The filesystem directory below which content and index data is stored. Should be on a shared disk if this is a clustered installation."/>
|
||||
@ -8,4 +17,6 @@
|
||||
<Environment override="false" type="java.lang.Boolean" name="properties/hibernate.jdbc.use_get_generated_keys" description="Enable use of JDBC3 PreparedStatement.getGeneratedKeys() to retrieve natively generated keys after insert. Requires JDBC3+ driver. Set to false if your driver has problems with the Hibernate identifier generators. By default, tries to determine the driver capabilities using connection metadata."/>
|
||||
<Environment override="false" type="java.lang.String" name="properties/hibernate.default_schema" description="Qualify unqualified table names with the given schema/tablespace in generated SQL. It may be necessary to set this when the target database has more than one schema."/>
|
||||
-->
|
||||
|
||||
|
||||
</Context>
|
||||
|
@ -13,4 +13,6 @@ public class AmpModel {
|
||||
public static final String AMP_FOLDER_LIB = "lib";
|
||||
|
||||
public static final List<String> EXTENSION_LIST = Arrays.asList(new String[] {"jar","ejb","ejb-client","test-jar"});
|
||||
|
||||
public static final String EXCLUDE_WEB_RESOURCES = "web/**";
|
||||
}
|
||||
|
@ -73,6 +73,18 @@ public class AmpMojo extends AbstractMojo {
|
||||
*/
|
||||
protected boolean includeDependencies;
|
||||
|
||||
|
||||
/**
|
||||
* Whether the AMP /web folder should be added or not to the generated AMP file.
|
||||
* By default it's true so all web resources are package in the war. Can be disabled to enable quick loading of web resources
|
||||
* from sources during development (e.g. in an IDE)
|
||||
*
|
||||
* @parameter property="maven.alfresco.includeWebResources" default-value="true"
|
||||
* @required
|
||||
*/
|
||||
protected boolean includeWebResources;
|
||||
|
||||
|
||||
/**
|
||||
* Whether the JAR produced should be attached as a separate 'classes' artifact.
|
||||
*
|
||||
@ -187,6 +199,19 @@ public class AmpMojo extends AbstractMojo {
|
||||
throw new MojoExecutionException("Error creating JAR", e);
|
||||
}
|
||||
}
|
||||
|
||||
private String[] getResourcesExcludes() {
|
||||
/*
|
||||
We might want to selectively exclude the /web folder to packaged in the AMP, since we want to "hot" load this directly from sources using tomcat7 virtual
|
||||
webapp features (from context.xml). While the "Loader" tag allows a searchVirtualFirst (so we can have both classes in the WAR and in a duplicate location which
|
||||
takes precedence, we can't do that for the "Resources" which either need to be in the webapp or outside.
|
||||
In the default packaging it's not excluded so the excludes are empty, but this property is set to exclude the /web folder -->
|
||||
*/
|
||||
if(!includeWebResources)
|
||||
return new String[] {AmpModel.EXCLUDE_WEB_RESOURCES};
|
||||
else
|
||||
return new String[] {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns the AMP archive, invoking the AmpArchiver
|
||||
@ -216,7 +241,7 @@ public class AmpMojo extends AbstractMojo {
|
||||
getLog().warn("ampBuildDirectory does not exist - AMP will be empty");
|
||||
} else {
|
||||
try {
|
||||
ampArchiver.getArchiver().addDirectory(this.ampBuildDirectory, new String[]{"**"}, new String[]{});
|
||||
ampArchiver.getArchiver().addDirectory(this.ampBuildDirectory, new String[]{"**"}, getResourcesExcludes());
|
||||
ampArchiver.createArchive(this.session, this.project, this.archive);
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
@ -76,6 +76,8 @@
|
||||
<app.amp.folder>src/main/amp</app.amp.folder>
|
||||
<app.amp.output.folder>../${project.build.finalName}</app.amp.output.folder>
|
||||
<app.amp.test.output.folder>${project.build.directory}/amp-test-classpath</app.amp.test.output.folder>
|
||||
<!-- Empty AMP source excludes by default, see the amp-to-war profile for usage example -->
|
||||
<app.amp.excludes></app.amp.excludes>
|
||||
<app.properties.folder>src/main/properties/${env}</app.properties.folder>
|
||||
<app.properties.test.folder>src/test/properties/${env}</app.properties.test.folder>
|
||||
<app.properties.include>**</app.properties.include>
|
||||
@ -328,11 +330,11 @@
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>${app.filtering.enabled}</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>${app.amp.folder}</directory>
|
||||
<targetPath>${app.amp.output.folder}</targetPath>
|
||||
<filtering>${app.filtering.enabled}</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>${app.amp.folder}</directory>
|
||||
<targetPath>${app.amp.output.folder}</targetPath>
|
||||
<filtering>${app.filtering.enabled}</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<testResources>
|
||||
<testResource>
|
||||
@ -473,7 +475,7 @@
|
||||
</resource>
|
||||
<!-- If exists, copies the module properties in the right classpath, to install it at test time -->
|
||||
<resource>
|
||||
<directory>${app.amp.folder}/config</directory>
|
||||
<directory>${app.amp.folder}</directory>
|
||||
<filtering>${app.filtering.enabled}</filtering>
|
||||
<includes>
|
||||
<include>module.properties</include>
|
||||
@ -507,6 +509,19 @@
|
||||
<argLine>${app.testing.jvm.args}</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Add RAD capabilities for remote JUnit test running. This is added to Tomcat classpath,
|
||||
so the custom JUnit test receiver is found in the running webapp classpath -->
|
||||
<plugin>
|
||||
<groupId>org.apache.tomcat.maven</groupId>
|
||||
<artifactId>tomcat7-maven-plugin</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.alfresco.maven</groupId>
|
||||
<artifactId>alfresco-rad</artifactId>
|
||||
<version>${maven.alfresco.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
@ -515,11 +530,12 @@
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- Add RAD capabilities for remote JUnit test running (scope=compile. So it will be available in the webapp (runtime) and in the test classpath (client) -->
|
||||
<!-- Add RAD capabilities for remote JUnit test running. Scope=test so the custom JUnit remote runner is found in the Maven test classpath -->
|
||||
<dependency>
|
||||
<groupId>org.alfresco.maven</groupId>
|
||||
<artifactId>alfresco-rad</artifactId>
|
||||
<version>${maven.alfresco.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!--
|
||||
| Requires this explicit test dependency, for a Spring 3.0.5 bug
|
||||
@ -642,6 +658,10 @@
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<!-- We need to selectively not install web resources so to enable rapid dev -->
|
||||
<includeWebResources>false</includeWebResources>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Configures tomcat to run against the Alfresco WAR with Tomcat7 virtual webapp features.
|
||||
(http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Virtual_webapp)
|
||||
|
Loading…
x
Reference in New Issue
Block a user