From ea4c12a83669ea1e57cd799d564e43b1b47f10d8 Mon Sep 17 00:00:00 2001 From: Jose Luis Osorno Date: Tue, 26 Mar 2019 12:25:07 +0100 Subject: [PATCH] Archetypes - Change platform archetype build approach - Build the project using package goal instead of install - Copy the test dependencies only when IT is executed - Add the build_start_it_supported task to execution scripts --- .../resources/archetype-resources/README.md | 2 + .../resources/archetype-resources/pom.xml | 112 +++++++++--------- .../resources/archetype-resources/run.bat | 16 ++- .../main/resources/archetype-resources/run.sh | 16 ++- 4 files changed, 83 insertions(+), 63 deletions(-) diff --git a/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/README.md b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/README.md index 78a55f6e..cbe72942 100644 --- a/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/README.md +++ b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/README.md @@ -14,6 +14,8 @@ All the services of the project are now run as docker containers. The run script * `build_start`. Build the whole project, recreate the ACS docker image, start the dockerised environment composed by ACS, Share (optional), ASS and PostgreSQL and tail the logs of all the containers. + * `build_start_it_supported`. Build the whole project including dependencies required for IT execution, recreate the ACS docker image, start the dockerised environment + composed by ACS, Share (optional), ASS and PostgreSQL and tail the logs of all the containers. * `start`. Start the dockerised environment without building the project and tail the logs of all the containers. * `stop`. Stop the dockerised environment. * `purge`. Stop the dockerised container and delete all the persistent data (docker volumes). diff --git a/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/pom.xml b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/pom.xml index aa7b82b4..c9815158 100644 --- a/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/pom.xml +++ b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/pom.xml @@ -192,6 +192,44 @@ + + copy-repository-extension + package + + copy-resources + + + ${project.build.directory}/extensions + + + target + + ${build.finalName}.jar + + false + + + + + + copy-repository-tests + pre-integration-test + + copy-resources + + + ${project.build.directory}/extensions + + + target + + ${build.finalName}-tests.jar + + false + + + + @@ -200,73 +238,29 @@ maven-dependency-plugin 3.1.1 - + - copy-repo-extension - pre-integration-test - - copy - - - - - ${groupId} - ${artifactId} - ${project.version} - false - ${project.build.directory}/extensions - - - - - ${groupId} - ${artifactId} - ${project.version} - tests - false - ${project.build.directory}/extensions - - - org.alfresco.maven - alfresco-rad - ${alfresco.sdk.version} - 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-platform-jar-archetype/src/main/resources/archetype-resources/run.bat b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/run.bat index 2ebcca1f..e735564a 100644 --- a/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/run.bat +++ b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/run.bat @@ -12,7 +12,7 @@ IF NOT [%M2_HOME%]==[] ( ) IF [%1]==[] ( - echo "Usage: %0 {build_start|start|stop|purge|tail|build_test|test}" + echo "Usage: %0 {build_start|build_start_it_supported|start|stop|purge|tail|build_test|test}" GOTO END ) @@ -23,6 +23,14 @@ IF %1==build_start ( CALL :tail GOTO END ) +IF %1==build_start_it_supported ( + CALL :down + CALL :build + CALL :prepare_test + CALL :start + CALL :tail + GOTO END +) IF %1==start ( CALL :start CALL :tail @@ -44,6 +52,7 @@ IF %1==tail ( IF %1==build_test ( CALL :down CALL :build + CALL :prepare_test CALL :start CALL :test CALL :tail_all @@ -70,7 +79,7 @@ EXIT /B 0 ) EXIT /B 0 :build - call %MVN_EXEC% clean install -DskipTests + call %MVN_EXEC% clean package EXIT /B 0 :tail docker-compose -f "%COMPOSE_FILE_PATH%" logs -f @@ -78,6 +87,9 @@ 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 +EXIT /B 0 :test call %MVN_EXEC% verify EXIT /B 0 diff --git a/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/run.sh b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/run.sh index 3024fc36..14b7dcf6 100755 --- a/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/run.sh +++ b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/run.sh @@ -29,7 +29,7 @@ purge() { } build() { - ${symbol_dollar}MVN_EXEC clean install -DskipTests=true + ${symbol_dollar}MVN_EXEC clean package } tail() { @@ -40,6 +40,10 @@ tail_all() { docker-compose -f ${symbol_dollar}COMPOSE_FILE_PATH logs --tail="all" } +prepare_test() { + ${symbol_dollar}MVN_EXEC verify -DskipTests=true +} + test() { ${symbol_dollar}MVN_EXEC verify } @@ -51,6 +55,13 @@ case "${symbol_dollar}1" in start tail ;; + build_start_it_supported) + down + build + prepare_test + start + tail + ;; start) start tail @@ -68,6 +79,7 @@ case "${symbol_dollar}1" in build_test) down build + prepare_test start test tail_all @@ -77,5 +89,5 @@ case "${symbol_dollar}1" in test ;; *) - echo "Usage: ${symbol_dollar}0 {build_start|start|stop|purge|tail|build_test|test}" + echo "Usage: ${symbol_dollar}0 {build_start|build_start_it_supported|start|stop|purge|tail|build_test|test}" esac \ No newline at end of file