diff --git a/archetypes/alfresco-amp-archetype/src/main/resources/archetype-resources/src/main/amp/web/jsp/demoamp.jsp b/archetypes/alfresco-amp-archetype/src/main/resources/archetype-resources/src/main/amp/web/jsp/demoamp.jsp index 2fe9c38a..027635ba 100644 --- a/archetypes/alfresco-amp-archetype/src/main/resources/archetype-resources/src/main/amp/web/jsp/demoamp.jsp +++ b/archetypes/alfresco-amp-archetype/src/main/resources/archetype-resources/src/main/amp/web/jsp/demoamp.jsp @@ -1,6 +1,3 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) \ No newline at end of file + --> + This is a demo JSP. When running with -Pamp-to-war, just change this text and it will be automatically reloaded! \ No newline at end of file diff --git a/archetypes/share-amp-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml b/archetypes/share-amp-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml index 17097a89..05ed764c 100644 --- a/archetypes/share-amp-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml +++ b/archetypes/share-amp-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -35,7 +35,7 @@ src/main/amp - **/*.jsp + **/* **/*.xml **/*.properties **/*.txt @@ -54,20 +54,20 @@ **/*.css - + src/main/amp/config/alfresco/module/__artifactId__ - + src/main/amp/web - + src/main/amp/web/themes - + src/main/amp/web/js - + src/main/amp/web/components @@ -80,7 +80,7 @@ src/test/resources - **/*.properties + **/* diff --git a/archetypes/share-amp-archetype/src/main/resources/archetype-resources/pom.xml b/archetypes/share-amp-archetype/src/main/resources/archetype-resources/pom.xml index f63ca26d..d9bf6bc2 100644 --- a/archetypes/share-amp-archetype/src/main/resources/archetype-resources/pom.xml +++ b/archetypes/share-amp-archetype/src/main/resources/archetype-resources/pom.xml @@ -21,30 +21,24 @@ | For more available properties see the alfresco-sdk-parent POM. --> - - ${alfresco_target_groupId} + + share + + + 8081 + + + http://localhost:8080/alfresco + ${alfresco_target_version} + WARN - alf_data_dev - - ${alfresco_target_amp_client_war} - - ${alfresco_target_amp_client_war_groupId} - - ${alfresco_target_amp_client_war_version} - - local - - - 8081 + - - junit - junit - 4.8.1 - test - + + + + true + + false + + + + + + + + + + + + + alfresco-noauth + Alfresco - unauthenticated access + Access to Alfresco Repository WebScripts that do not require authentication + alfresco + ${alfresco.repo.url}/s + none + + + + alfresco + Alfresco - user access + Access to Alfresco Repository WebScripts that require user authentication + alfresco + ${alfresco.repo.url}/s + user + + + + alfresco-feed + Alfresco Feed + Alfresco Feed - supports basic HTTP authentication via the EndPointProxyServlet + http + ${alfresco.repo.url}/s + true + user + + + + activiti-admin + Activiti Admin UI - user access + Access to Activiti Admin UI, that requires user authentication + activiti-admin-connector + ${alfresco.repo.url}/activiti-admin + user + + + + + diff --git a/archetypes/share-amp-archetype/src/main/resources/archetype-resources/tomcat/context.xml b/archetypes/share-amp-archetype/src/main/resources/archetype-resources/tomcat/context.xml index bc392e06..b277f925 100644 --- a/archetypes/share-amp-archetype/src/main/resources/archetype-resources/tomcat/context.xml +++ b/archetypes/share-amp-archetype/src/main/resources/archetype-resources/tomcat/context.xml @@ -1,5 +1,14 @@ + + + + + + + + + diff --git a/plugins/alfresco-maven-plugin/src/main/java/org/alfresco/maven/plugin/AmpModel.java b/plugins/alfresco-maven-plugin/src/main/java/org/alfresco/maven/plugin/AmpModel.java index 478c4f95..e8cc7a51 100644 --- a/plugins/alfresco-maven-plugin/src/main/java/org/alfresco/maven/plugin/AmpModel.java +++ b/plugins/alfresco-maven-plugin/src/main/java/org/alfresco/maven/plugin/AmpModel.java @@ -13,4 +13,6 @@ public class AmpModel { public static final String AMP_FOLDER_LIB = "lib"; public static final List EXTENSION_LIST = Arrays.asList(new String[] {"jar","ejb","ejb-client","test-jar"}); + + public static final String EXCLUDE_WEB_RESOURCES = "web/**"; } diff --git a/plugins/alfresco-maven-plugin/src/main/java/org/alfresco/maven/plugin/AmpMojo.java b/plugins/alfresco-maven-plugin/src/main/java/org/alfresco/maven/plugin/AmpMojo.java index 473e4018..150a6500 100644 --- a/plugins/alfresco-maven-plugin/src/main/java/org/alfresco/maven/plugin/AmpMojo.java +++ b/plugins/alfresco-maven-plugin/src/main/java/org/alfresco/maven/plugin/AmpMojo.java @@ -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) { diff --git a/poms/alfresco-sdk-parent/pom.xml b/poms/alfresco-sdk-parent/pom.xml index 85e01063..2258ed9e 100644 --- a/poms/alfresco-sdk-parent/pom.xml +++ b/poms/alfresco-sdk-parent/pom.xml @@ -76,6 +76,8 @@ src/main/amp ../${project.build.finalName} ${project.build.directory}/amp-test-classpath + + src/main/properties/${env} src/test/properties/${env} ** @@ -328,11 +330,11 @@ src/main/resources ${app.filtering.enabled} - - ${app.amp.folder} - ${app.amp.output.folder} - ${app.filtering.enabled} - + + ${app.amp.folder} + ${app.amp.output.folder} + ${app.filtering.enabled} + @@ -473,7 +475,7 @@ - ${app.amp.folder}/config + ${app.amp.folder} ${app.filtering.enabled} module.properties @@ -507,6 +509,19 @@ ${app.testing.jvm.args} + + + org.apache.tomcat.maven + tomcat7-maven-plugin + + + org.alfresco.maven + alfresco-rad + ${maven.alfresco.version} + + + @@ -515,11 +530,12 @@ junit test - + org.alfresco.maven alfresco-rad ${maven.alfresco.version} + test + false +