From 6e5445a271d1920fde6b6f056f06ea07b3880d8a Mon Sep 17 00:00:00 2001 From: Piotr Anders Date: Thu, 7 Feb 2019 17:11:16 +0100 Subject: [PATCH] * Changing run scripts to execute maven package/verify instead of install (and to run unit tests during build). * Changing artifacts collection for docker deployment in platform-docker module to use scopes (for integration tests) and adding comment how to deal with amps only or amps+jars extenstions. --- .../pom.xml | 86 ++++++++----------- .../__rootArtifactId__-platform/pom.xml | 1 - .../__rootArtifactId__-share-docker/pom.xml | 7 +- .../__rootArtifactId__-share/pom.xml | 1 - .../resources/archetype-resources/run.bat | 12 ++- .../main/resources/archetype-resources/run.sh | 13 ++- docs/advanced-topics/amps.md | 45 +++------- 7 files changed, 69 insertions(+), 96 deletions(-) diff --git a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform-docker/pom.xml b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform-docker/pom.xml index 3ec2b55f..a2d0d4ce 100644 --- a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform-docker/pom.xml +++ b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform-docker/pom.xml @@ -22,6 +22,25 @@ ${rootArtifactId}-platform ${version} + + ${groupId} + ${rootArtifactId}-integration-tests + ${version} + test + tests + + + @@ -30,66 +49,29 @@ org.apache.maven.plugins maven-dependency-plugin - + - copy-test-dependencies - pre-integration-test - - copy - - - - - - - org.alfresco.maven - alfresco-rad - ${alfresco.sdk.version} - false - ${project.build.directory}/extensions - - - ${groupId} - ${rootArtifactId}-integration-tests - ${version} - tests - false - ${project.build.directory}/extensions - - - junit - junit - 4.12 - false - ${project.build.directory}/extensions - - - org.mockito - mockito-all - 1.9.5 - false - ${project.build.directory}/extensions - - - org.apache.httpcomponents - httpclient - 4.5.2 - false - ${project.build.directory}/extensions - - - - - - - copy-third-party-dependencies + collect-test-artifacts pre-integration-test copy-dependencies + + ${project.build.directory}/extensions + compile + + + + + collect-extensions + package + + copy-dependencies + ${project.build.directory}/extensions runtime + diff --git a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/pom.xml b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/pom.xml index 59686950..fe6e5537 100644 --- a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/pom.xml +++ b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/pom.xml @@ -17,7 +17,6 @@ - diff --git a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-share-docker/pom.xml b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-share-docker/pom.xml index b4fd0b8f..9a958b9e 100644 --- a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-share-docker/pom.xml +++ b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-share-docker/pom.xml @@ -30,16 +30,17 @@ org.apache.maven.plugins maven-dependency-plugin - + - copy-third-party-dependencies - pre-integration-test + collect-extensions + package copy-dependencies ${project.build.directory}/extensions runtime + diff --git a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-share/pom.xml b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-share/pom.xml index de0c545a..a95f3678 100644 --- a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-share/pom.xml +++ b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-share/pom.xml @@ -25,7 +25,6 @@ share classes - diff --git a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/run.bat b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/run.bat index c1b02a04..65eb6672 100644 --- a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/run.bat +++ b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/run.bat @@ -56,6 +56,7 @@ IF %1==reload_acs ( IF %1==build_test ( CALL :down CALL :build + CALL :prepare-test CALL :start CALL :test CALL :tail_all @@ -88,17 +89,17 @@ EXIT /B 0 ) EXIT /B 0 :build - call %MVN_EXEC% clean install -DskipTests + call %MVN_EXEC% clean package EXIT /B 0 :build_share docker-compose -f "%COMPOSE_FILE_PATH%" kill ${rootArtifactId}-share docker-compose -f "%COMPOSE_FILE_PATH%" rm -f ${rootArtifactId}-share - call %MVN_EXEC% clean install -DskipTests -pl ${rootArtifactId}-share + call %MVN_EXEC% clean package -pl ${rootArtifactId}-share,${rootArtifactId}-share-docker EXIT /B 0 :build_acs docker-compose -f "%COMPOSE_FILE_PATH%" kill ${rootArtifactId}-acs docker-compose -f "%COMPOSE_FILE_PATH%" rm -f ${rootArtifactId}-acs - call %MVN_EXEC% clean install -DskipTests -pl ${rootArtifactId}-platform + call %MVN_EXEC% clean package -pl ${rootArtifactId}-platform,${rootArtifactId}-platform-docker EXIT /B 0 :tail docker-compose -f "%COMPOSE_FILE_PATH%" logs -f @@ -106,8 +107,11 @@ EXIT /B 0 :tail_all docker-compose -f "%COMPOSE_FILE_PATH%" logs --tail="all" EXIT /B 0 +:prepare-test + call %MVN_EXEC% verify -DskipTests=true -pl ${rootArtifactId}-platform,${rootArtifactId}-integration-tests,${rootArtifactId}-platform-docker +EXIT /B 0 :test - call %MVN_EXEC% verify -pl ${rootArtifactId}-integration-tests + call %MVN_EXEC% verify -pl ${rootArtifactId}-platform,${rootArtifactId}-integration-tests EXIT /B 0 :purge docker volume rm -f ${rootArtifactId}-acs-volume diff --git a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/run.sh b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/run.sh index 4eedc441..d944ccf9 100755 --- a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/run.sh +++ b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/run.sh @@ -37,19 +37,19 @@ purge() { } build() { - ${symbol_dollar}MVN_EXEC clean install -DskipTests=true + ${symbol_dollar}MVN_EXEC clean package } build_share() { docker-compose -f ${symbol_dollar}COMPOSE_FILE_PATH kill ${rootArtifactId}-share yes | docker-compose -f ${symbol_dollar}COMPOSE_FILE_PATH rm -f ${rootArtifactId}-share - ${symbol_dollar}MVN_EXEC clean install -DskipTests=true -pl ${rootArtifactId}-share,${rootArtifactId}-share-docker + ${symbol_dollar}MVN_EXEC clean package -pl ${rootArtifactId}-share,${rootArtifactId}-share-docker } build_acs() { docker-compose -f ${symbol_dollar}COMPOSE_FILE_PATH kill ${rootArtifactId}-acs yes | docker-compose -f ${symbol_dollar}COMPOSE_FILE_PATH rm -f ${rootArtifactId}-acs - ${symbol_dollar}MVN_EXEC clean install -DskipTests=true -pl ${rootArtifactId}-platform,${rootArtifactId}-platform-docker + ${symbol_dollar}MVN_EXEC clean package -pl ${rootArtifactId}-platform,${rootArtifactId}-platform-docker } tail() { @@ -60,8 +60,12 @@ tail_all() { docker-compose -f ${symbol_dollar}COMPOSE_FILE_PATH logs --tail="all" } +prepare_test() { + ${symbol_dollar}MVN_EXEC verify -DskipTests=true -pl ${rootArtifactId}-platform,${rootArtifactId}-integration-tests,${rootArtifactId}-platform-docker +} + test() { - ${symbol_dollar}MVN_EXEC verify -pl ${rootArtifactId}-integration-tests + ${symbol_dollar}MVN_EXEC verify -pl ${rootArtifactId}-platform,${rootArtifactId}-integration-tests } case "${symbol_dollar}1" in @@ -98,6 +102,7 @@ case "${symbol_dollar}1" in build_test) down build + prepare_test start test tail_all diff --git a/docs/advanced-topics/amps.md b/docs/advanced-topics/amps.md index ba0009c4..c6c91243 100644 --- a/docs/advanced-topics/amps.md +++ b/docs/advanced-topics/amps.md @@ -73,39 +73,22 @@ do is modify the `pom.xml` file of the corresponding docker module / project in ``` -2. Modify the Maven Dependency Plugin in the file `PROJECT_ARTIFACT_ID-platform-docker/pom.xml` to set the platform JAR dependency type to `amp`: +2. Add the `amp` to the `collect-extensions` execution in maven-dependency-plugin plugin build configuration in the same file: ``` - - org.apache.maven.plugins - maven-dependency-plugin - - - - copy-repo-extension - pre-integration-test - - copy - - - - - org.alfresco - sample-module-platform - 1.0-SNAPSHOT - false - ${project.build.directory}/extensions - amp - - - ... - - - - - ... - - + + + collect-extensions + package + + copy-dependencies + + + ${project.build.directory}/extensions + runtime + amp + + ``` 3. Repeat these steps for the share module in the file `PROJECT_ARTIFACT_ID-share-docker/pom.xml`.