* 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.
This commit is contained in:
Piotr Anders
2019-02-07 17:11:16 +01:00
parent 2db3051599
commit 6e5445a271
7 changed files with 69 additions and 96 deletions

View File

@@ -22,6 +22,25 @@
<artifactId>${rootArtifactId}-platform</artifactId>
<version>${version}</version>
</dependency>
<dependency>
<groupId>${groupId}</groupId>
<artifactId>${rootArtifactId}-integration-tests</artifactId>
<version>${version}</version>
<scope>test</scope>
<classifier>tests</classifier>
</dependency>
<!-- Add any additional AMPs or extension JARs here that you want to be deployed in Alfresco -->
<!-- IMPORTANT:
If using amp extensions only, add <includeTypes>amp</includeTypes> to the "collect-extensions" execution below.
If using both amp and jar extensions, you have to add:
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
to each amp dependency definition.
-->
</dependencies>
<build>
@@ -30,66 +49,29 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<!-- Copy the dependencies required for execute integration tests -->
<!-- Copy the repository extension and the dependencies required for execute integration tests -->
<execution>
<id>copy-test-dependencies</id>
<phase>pre-integration-test</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<!-- Test dependencies -->
<!-- We need these dependencies installed in ACS in order to execute the test remotely making use of the Alfresco RAD module -->
<artifactItem>
<groupId>org.alfresco.maven</groupId>
<artifactId>alfresco-rad</artifactId>
<version>${alfresco.sdk.version}</version>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/extensions</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>${groupId}</groupId>
<artifactId>${rootArtifactId}-integration-tests</artifactId>
<version>${version}</version>
<classifier>tests</classifier>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/extensions</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/extensions</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/extensions</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/extensions</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<!-- Copy the dependencies (JARs or AMPs) declared in this module -->
<execution>
<id>copy-third-party-dependencies</id>
<id>collect-test-artifacts</id>
<phase>pre-integration-test</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/extensions</outputDirectory>
<excludeScope>compile</excludeScope>
</configuration>
</execution>
<!-- Collect extensions (JARs or AMPs) declared in this module do be deployed to docker -->
<execution>
<id>collect-extensions</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/extensions</outputDirectory>
<includeScope>runtime</includeScope>
<!-- IMPORTANT: if using amp dependencies only, add <includeTypes>amp</includeTypes> -->
</configuration>
</execution>
</executions>

View File

@@ -17,7 +17,6 @@
</properties>
<dependencies>
<!-- Add here any JAR or AMP dependency that needs to be deployed to ACS -->
</dependencies>
<build>

View File

@@ -30,16 +30,17 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<!-- Copy the dependencies (JARs or AMPs) declared in this module -->
<!-- Collect extensions (JARs or AMPs) declared in this module do be deployed to docker -->
<execution>
<id>copy-third-party-dependencies</id>
<phase>pre-integration-test</phase>
<id>collect-extensions</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/extensions</outputDirectory>
<includeScope>runtime</includeScope>
<!-- IMPORTANT: if using amp dependencies only, add <includeTypes>amp</includeTypes> -->
</configuration>
</execution>
</executions>

View File

@@ -25,7 +25,6 @@
<artifactId>share</artifactId>
<classifier>classes</classifier>
</dependency>
<!-- Add here any JAR or AMP dependency that needs to be deployed to share -->
</dependencies>
<build>

View File

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

View File

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

View File

@@ -73,39 +73,22 @@ do is modify the `pom.xml` file of the corresponding docker module / project in
</dependencies>
```
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 `<includeTypes>amp</includeTypes>` to the `collect-extensions` execution in maven-dependency-plugin plugin build configuration in the same file:
```
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<!-- Copy the repository extension and the dependencies required for execute integration tests -->
<!-- Collect extensions (JARs or AMPs) declared in this module do be deployed to docker -->
<execution>
<id>copy-repo-extension</id>
<phase>pre-integration-test</phase>
<id>collect-extensions</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.alfresco</groupId>
<artifactId>sample-module-platform</artifactId>
<version>1.0-SNAPSHOT</version>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/extensions</outputDirectory>
<type>amp</type>
</artifactItem>
<!-- Test dependencies -->
...
</artifactItems>
<includeScope>runtime</includeScope>
<includeTypes>amp</includeTypes>
</configuration>
</execution>
<!-- Copy other dependencies (JARs or AMPs) declared in the platform module -->
...
</executions>
</plugin>
```
3. Repeat these steps for the share module in the file `PROJECT_ARTIFACT_ID-share-docker/pom.xml`.