Issue #197 - Enabled spring-loaded RAD ide friendly integration features

for repo amp archetype. Removed dead amp-to-war code.

Consolidated in amp-to-war:
- installation of the AMP
- rapid development / ide integration (searchVirtualFirst)
- tested junit-remote with spring-loaded (works like a charm)

Removed rad profile and created a (legacy) Jrebel profile to just create
the Jrebel files (unneeded when using Spring-loaded)

Tested:
- mvn test
- mvn integration-test -Pamp-to-war
- reloading of classes / webapp resources / unit tests
- remote unit test running

Run your build with MAVEN_OPTS="-Xms1024m -Xmx2048m -XX:PermSize=1024m
-javaagent:/path/to/springloaded/springloaded-1.2.0.RELEASE.jar" mvn
clean install -Pamp-to-war
This commit is contained in:
mindthegab 2014-08-05 23:15:30 -04:00
parent addad0866f
commit 351a81f4f0
4 changed files with 193 additions and 129 deletions

View File

@ -57,7 +57,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">

View File

@ -0,0 +1,53 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<!--
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.
-->
<beans>
<!-- This disables javascript compilation so that webscripts can be hot reloaded -->
<bean id="javaScriptProcessor" class="org.alfresco.repo.jscript.RhinoScriptProcessor" init-method="register">
<property name="name">
<value>javascript</value>
</property>
<property name="extension">
<value>js</value>
</property>
<!-- compile javascript and cache compiled scripts -->
<property name="compile">
<value>false</value>
</property>
<!-- allow sharing of sealed scopes for performance -->
<!-- disable to give each script it's own new scope which can be extended -->
<property name="shareSealedScopes">
<value>true</value>
</property>
<property name="scriptService">
<ref bean="scriptService"/>
</property>
<!-- Creates ScriptNodes which require the ServiceRegistry -->
<property name="serviceRegistry">
<ref bean="ServiceRegistry"/>
</property>
<property name="storeUrl">
<value>${spaces.store}</value>
</property>
<property name="storePath">
<value>${spaces.company_home.childname}</value>
</property>
</bean>
</beans>

View File

@ -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>

View File

@ -22,7 +22,7 @@
<version>2.0.0-SNAPSHOT</version>
<prerequisites>
<maven>3.0.3</maven>
<maven>3.2.2</maven>
</prerequisites>
<properties>
@ -204,7 +204,6 @@
<version>${maven.war.version}</version>
<configuration>
<archiveClasses>false</archiveClasses>
<warSourceExcludes>tools/**</warSourceExcludes>
<archive>
<manifest>
<addClasspath>true</addClasspath>
@ -282,6 +281,38 @@
</dependency>
</dependencies>
</plugin>
<!--m2e configuration only to prevent errors in import.
NOTE: This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.alfresco.maven.plugin
</groupId>
<artifactId>
alfresco-maven-plugin
</artifactId>
<versionRange>
[2.0.0-SNAPSHOT,)
</versionRange>
<goals>
<goal>set-version</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
@ -393,7 +424,6 @@
</build>
</profile>
<!-- Enable AMP lifecycle if finds a module.properties, including unit testing support -->
<profile>
<id>enable-amp</id>
@ -412,14 +442,15 @@
</build>
</profile>
<!-- Enable AMP lifecycle if finds a module.properties, including unit testing support -->
<!-- Enable AMP testing if finds a module.properties, including unit testing support -->
<profile>
<id>enable-alfresco-testing</id>
<id>enable-amp-dev</id>
<activation>
<file>
<exists>src/test/java</exists>
<exists>src/main/amp/module.properties</exists>
</file>
</activation>
<!-- Basically copies AMP config and module.properties in target/test-classes so that they can be loaded at test time and the module can be installed -->
<build>
<plugins>
<plugin>
@ -436,27 +467,70 @@
<resource>
<directory>${app.amp.folder}/config</directory>
<filtering>${app.filtering.enabled}</filtering>
<excludes>
<exclude>module.properties</exclude>
</excludes>
</resource>
<!-- If exists, copies the module properties in the right classpath, to install it at test time -->
<resource>
<directory>${app.amp.folder}/config</directory>
<filtering>${app.filtering.enabled}</filtering>
<includes>
<include>module.properties</include>
</includes>
<targetPath>alfresco/module/${project.artifactId}</targetPath>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- Enables alfresco testing dependencies if a src/test/java folder is found, by adding appropriate dependencies -->
<profile>
<id>enable-alfresco-testing</id>
<activation>
<file>
<exists>src/test/java</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.version}</version>
<configuration>
<argLine>${app.testing.jvm.args}</argLine>
<additionalClasspathElements>
<!-- Adds the previously built ${app.amp.test.output.folder} to test classpath to enable module installation at test time -->
<additionalClasspathElement>${app.amp.test.output.folder}</additionalClasspathElement>
</additionalClasspathElements>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<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) -->
<dependency>
<groupId>org.alfresco.maven</groupId>
<artifactId>alfresco-rad</artifactId>
<version>${maven.alfresco.version}</version>
</dependency>
<!--
| Requires this explicit test dependency, for a Spring 3.0.5 bug
| See https://jira.springsource.org/browse/SPR-8527
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.0.6.RELEASE</version>
<scope>provided</scope>
</dependency>
<!-- SDK AMP Testing Dependencies -->
<dependency>
<groupId>com.h2database</groupId>
@ -470,37 +544,14 @@
<version>${h2-support.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<!-- Add RAD capabilities for remote JUnit test running (client) -->
<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
| See https://jira.springsource.org/browse/SPR-8527
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.0.6.RELEASE</version>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
<!-- Profile to enable rapid application development with JRebel
and remote JUnit running, needs to be called explicitly
with -Prad -->
<!-- Profile to enable rapid application development with JRebel. Automatically generates rebel.xml files.
NOTE: This experimental feature added in the SDK 1.1.0 is now deprecated as of version 2.x in favor of spring-loaded.
Use at your own risk. This profile needs to be called explicitly with -Pjrebel -->
<profile>
<id>rad</id>
<id>jrebel</id>
<build>
<plugins>
<plugin>
@ -545,15 +596,6 @@
</plugin>
</plugins>
</build>
<dependencies>
<!-- Add RAD capabilities for remote JUnit test running (client) -->
<dependency>
<groupId>org.alfresco.maven</groupId>
<artifactId>alfresco-rad</artifactId>
<version>${maven.alfresco.version}</version>
</dependency>
</dependencies>
</profile>
<!-- Enable AMP project packing on a WAR and run embedded in Tomcat -->
@ -587,58 +629,7 @@
</execution>
</executions>
</plugin>
<!-- Configure tomcat context.xml included in the webapp with proper filtering -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<!-- When the AMP runs locally, src/test/webapp and src/test/resources will contain -->
<!-- the location of the configuration files -->
<execution>
<id>copy-alfresco-test-resources</id>
<phase>prepare-package</phase>
<goals><goal>copy-resources</goal></goals>
<configuration>
<outputDirectory>${alfresco.client.war.folder}</outputDirectory>
<resources>
<resource>
<directory>src/test/webapp</directory>
</resource>
<resource>
<directory>${project.build.testOutputDirectory}</directory>
<targetPath>WEB-INF/classes</targetPath>
<filtering>${app.filtering.enabled}</filtering>
</resource>
<resource>
<directory>src/test/properties/${env}</directory>
<filtering>${app.filtering.enabled}</filtering>
<targetPath>WEB-INF/classes</targetPath>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-tomcat-resources</id>
<phase>prepare-package</phase>
<goals><goal>copy-resources</goal></goals>
<configuration>
<outputDirectory>${alfresco.client.war.folder}</outputDirectory>
<resources>
<resource>
<directory>tomcat</directory>
<filtering>${app.filtering.enabled}</filtering>
<targetPath>WEB-INF</targetPath>
<includes>
<include>context.xml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<!-- The current AMP artifact is installed into the Alfresco
folder using alfresco-maven-plugin -->
<!-- The current AMP artifact is installed into the Alfresco folder using alfresco-maven-plugin -->
<plugin>
<groupId>org.alfresco.maven.plugin</groupId>
<artifactId>alfresco-maven-plugin</artifactId>
@ -652,21 +643,30 @@
</execution>
</executions>
</plugin>
<!-- Configures tomcat to run against the overlaid WAR + AMP -->
<!-- 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)
The target/classes and target/test-classes (containing tests and the amp config for test purposes) are prepended to the
running webapp context, so changes from the IDE are automatically picked up first. See context.xml for details.
-->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<executions>
<execution>
<id>run-wars</id>
<id>run-embedded</id>
<goals>
<goal>run-war-only</goal>
<goal>run</goal>
</goals>
<phase>integration-test</phase>
<configuration>
<contextFile>${alfresco.client.war.folder}/WEB-INF/context.xml</contextFile>
<!-- To run a non WAR project -->
<useTestClasspath>false</useTestClasspath>
<ignorePackaging>true</ignorePackaging>
<useSeparateTomcatClassLoader>true</useSeparateTomcatClassLoader>
<systemProperties>
<java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
</systemProperties>
<delegate>true</delegate>
<contextFile>${project.basedir}/tomcat/context.xml</contextFile>
</configuration>
</execution>
</executions>
@ -740,7 +740,7 @@
<!-- Test for Alfresco version -->
<requireProperty>
<property>alfresco.version</property>
<message>The SDK is supported only for Alfresco 4.1.2+ and 4.2+ versions</message>
<message>The SDK 2.x is supported only for Alfresco 5.x Community and Enterprise versions</message>
<regex>^5\..*</regex>
</requireProperty>
<!-- Test for JDK version -->