Skip to content

Commit

Permalink
Merge pull request #1635 from eclipse/hcc/maven_update
Browse files Browse the repository at this point in the history
upd(maven): Update maven build infra
  • Loading branch information
heliocastro authored Sep 15, 2022
2 parents 1abff27 + f0f308e commit 0cfb802
Show file tree
Hide file tree
Showing 17 changed files with 132 additions and 83 deletions.
6 changes: 4 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Ignore base files on copy
deploy?
*/*/build
*/*/target
**/build
**/target
build
target
14 changes: 7 additions & 7 deletions .github/workflows/githubactions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,15 @@ jobs:
- uses: actions/checkout@v3

- name: Setup CouchDB
uses: iamssen/couchdb-github-action@master
with:
couchdb-version: '3.1'
run: scripts/startCouchdbForTests.sh

- name: Update properties with DB credentials
run: |
sudo sed -i 's/^couchdb.user\s*=/& '${COUCHDB_USER}'/' build-configuration/test-resources/couchdb-test.properties
sudo sed -i 's/^couchdb.password\s*=/& '${COUCHDB_PASSWORD}'/' build-configuration/test-resources/couchdb-test.properties
sudo mkdir -p /etc/sw360
sudo cp ./scripts/sw360BackendRestDockerConfig/etc_sw360/couchdb-test.properties /etc/sw360/
sudo cp ./build-configuration/test-resources/couchdb-test.properties /etc/sw360/
sudo cp ./scripts/sw360BackendRestDockerConfig/etc_sw360/rest-test.properties /etc/sw360/
sudo sed -i 's/^couchdb.user\s*=/& '${COUCHDB_USER}'/' /etc/sw360/couchdb-test.properties
sudo sed -i 's/^couchdb.password\s*=/& '${COUCHDB_PASSWORD}'/' /etc/sw360/couchdb-test.properties
- name: Set up JDK 11
run: |
Expand All @@ -63,7 +62,8 @@ jobs:
bash scripts/install-thrift.sh --no-cleanup
- name: Build SW360
run: mvn clean package --no-transfer-progress -P deploy -Dhelp-docs=true -Dbase.deploy.dir=. -Dliferay.deploy.dir=${PWD}/deploy -Dbackend.deploy.dir=${PWD}/deploy/webapps -Drest.deploy.dir=${PWD}/deploy/webapps -DRunComponentVisibilityRestrictionTest=false -DRunPrivateProjectAccessTest=false
run: |
mvn clean package --no-transfer-progress -P deploy -Dhelp-docs=true -Dbase.deploy.dir=. -Dliferay.deploy.dir=${PWD}/deploy -Dbackend.deploy.dir=${PWD}/deploy/webapps -Drest.deploy.dir=${PWD}/deploy/webapps -DRunComponentVisibilityRestrictionTest=false -DRunPrivateProjectAccessTest=false
- name: Run PrivateProjectAccessTest
run: |
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ RUN --mount=type=cache,mode=0755,target=/root/.m2,rw,sharing=locked \
&& setup_maven_proxy \
&& mvn clean package \
-P deploy -Dtest=org.eclipse.sw360.rest.resourceserver.restdocs.* \
-DfailIfNoTests=false \
-Dsurefire.failIfNoSpecifiedTests=false \
-Dbase.deploy.dir=. \
-Dliferay.deploy.dir=/sw360_deploy \
-Dbackend.deploy.dir=/sw360_tomcat_webapps \
Expand Down
23 changes: 4 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,32 +38,17 @@ This is a multi module maven file. please consider that we have the following mo
### Required software

* Java 11, tested with OpenJDK
* CouchDB, at least 2.1 (tested, may work with other releases of CouchDB as well), runs best with 3.1.1
* Liferay Portal CE 7.3.3 GA4 or 7.3.4 GA5
* CouchDB, at least 3.0 (tested, may work with other releases of CouchDB as well), runs best with 3.1.1
* Liferay Portal CE 7.4.3.18 GA18
* Apache Tomcat 9.0.X (which is bundled with Liferay)
* couchdb-lucene for search, please refer to installation details in the wiki, because a patch is required

In addition, the Liferay instance must provide the following dependecies via OSGi:

* Apache Commons Codec 1.12
* Apache Commons Collections4 4.4
* Apache Commons CSV 1.4
* Apache Commons IO 2.7
* Apache Commons Lang 2.4
* Apache Commons Logging 1.2
* Apache Commons Compress 1.20
* Google Gson 2.8.9
* Google Guava 31.0.1-jre
* Jackson Annotations 2.13.2
* Jackson Core 2.13.2
* Jackson Databind 2.13.2.2
* libthrift 0.14
* Apache Thrift 0.16

In order to build you will need:

* A git client
* Apache Maven 3.6.X
* Apache Thrift 0.13
* Apache Thrift 0.16

http://maven.apache.org/download.html#Installation

Expand Down
2 changes: 1 addition & 1 deletion backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
<version>${maven-source-plugin.version}</version>
</plugin>
</plugins>
</pluginManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public class AbstractMockServerTest {

public static boolean RUN_REST_INTEGRATION_TEST;

private static final String PROPERTIES_FILE_PATH = "/couchdb-test.properties";
private static final String PROPERTIES_FILE_PATH = "/rest-test.properties";

static {
Properties props = CommonUtils.loadProperties(AbstractMockServerTest.class, PROPERTIES_FILE_PATH);
Expand Down
8 changes: 3 additions & 5 deletions frontend/configuration/setenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,16 @@
#

# The following settings should be adapted to your needs
JAVA_MEMORY_MIN="2g"
JAVA_MEMORY_MAX="4g"
JAVA_MEMORY_MIN="3g"
JAVA_MEMORY_MAX="6g"

# The following settings should not be touched unless you know what you are doing
# Misconfiguration may be lead to an unusable instance.
JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF8"
JAVA_OPTS="$JAVA_OPTS -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false"
JAVA_OPTS="$JAVA_OPTS -Duser.timezone=GMT"
JAVA_OPTS="$JAVA_OPTS -Xms${JAVA_MEMORY_MIN} -Xmx${JAVA_MEMORY_MAX}"
JAVA_OPTS="$JAVA_OPTS -XX:+UseParNewGC"
JAVA_OPTS="$JAVA_OPTS -XX:+UseConcMarkSweepGC"
JAVA_OPTS="$JAVA_OPTS -XX:+CMSParallelRemarkEnabled"
JAVA_OPTS="$JAVA_OPTS -XX:+UseG1GC"
JAVA_OPTS="$JAVA_OPTS -XX:SurvivorRatio=20"

export JAVA_OPTS
10 changes: 1 addition & 9 deletions frontend/liferay-theme/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,9 @@
<build>
<finalName>org.eclipse.sw360.liferay-theme-${project.version}</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<version>${maven-war-plugin.version}</version>
<configuration>
<packagingExcludes>**/*.scss</packagingExcludes>
<webResources>
Expand Down
16 changes: 16 additions & 0 deletions frontend/liferay-theme/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright Siemens AG, 2013-2015. Part of the SW360 Portal Project.
~
~ This program and the accompanying materials are made
~ available under the terms of the Eclipse Public License 2.0
~ which is available at https://www.eclipse.org/legal/epl-2.0/
~
~ SPDX-License-Identifier: EPL-2.0
-->
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1">
<display-name>SW360 Liferay Theme</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
4 changes: 2 additions & 2 deletions libraries/lib-datahandler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<configuration>
<thriftExecutable>thrift</thriftExecutable>
<generator>java:generated_annotations=suppress</generator>
<checkStaleness>true</checkStaleness>scripts/startCouchdbForTests.sh
<checkStaleness>true</checkStaleness>
</configuration>
<executions>
<execution>
Expand All @@ -59,7 +59,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<version>${build-helper-maven-plugin.version}</version>
<executions>
<execution>
<id>thrift-sources</id>
Expand Down
6 changes: 3 additions & 3 deletions libraries/log4j-osgi-support/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<version>${maven-dependency-plugin.version}</version>
<executions>
<execution>
<id>copy-dependencies</id>
Expand All @@ -67,7 +67,7 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>4.2.1</version>
<version>${maven-bundle-plugin.version}</version>
<extensions>true</extensions>
<executions>
<execution>
Expand Down Expand Up @@ -113,4 +113,4 @@
</plugin>
</plugins>
</build>
</project>
</project>
55 changes: 45 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,26 @@
<patchlevel>0-SNAPSHOT</patchlevel>

<!-- Build version properties -->
<maven-jar-plugin.version>2.4</maven-jar-plugin.version>
<maven-source-plugin.version>2.4</maven-source-plugin.version>
<java.version>11</java.version>
<java_source.version>11</java_source.version>
<java_target.version>11</java_target.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<!-- Plugin version properties -->
<build-helper-maven-plugin.version>3.3.0</build-helper-maven-plugin.version>
<maven-bundle-plugin.version>5.1.8</maven-bundle-plugin.version>
<maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
<maven-dependency-plugin.version>3.3.0</maven-dependency-plugin.version>
<maven-failsafe-plugin.version>3.0.0-M7</maven-failsafe-plugin.version>
<maven-failsafe-plugin.version>3.0.0-M7</maven-failsafe-plugin.version>
<maven-jar-plugin.version>3.2.2</maven-jar-plugin.version>
<maven-resources-plugin.version>3.3.0</maven-resources-plugin.version>
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
<maven-surefire-plugin.version>3.0.0-M7</maven-surefire-plugin.version>
<maven-war-plugin.version>3.3.2</maven-war-plugin.version>
<versions-maven-plugin.version>2.12.0</versions-maven-plugin.version>


<!-- Dependencies version properties -->
<byte-buddy.version>1.12.13</byte-buddy.version>
<cloudant.version>2.19.1</cloudant.version>
Expand Down Expand Up @@ -84,7 +98,7 @@
<okhttp.version>4.3.1</okhttp.version>
<package-url.version>1.1.1</package-url.version>
<poi.version>4.1.2</poi.version>
<project-lombok.version>1.18.2</project-lombok.version>
<project-lombok.version>1.18.24</project-lombok.version>
<slf4j.version>1.7.30</slf4j.version>
<spring.version>5.3.19</spring.version>
<spring-boot.version>2.6.6</spring-boot.version>
Expand Down Expand Up @@ -471,7 +485,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<version>${maven-dependency-plugin.version}</version>
<executions>
<execution>
<id>add-build-configuration-resources</id>
Expand Down Expand Up @@ -515,12 +529,33 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<version>${maven-resources-plugin.version}</version>
<configuration>
<overwrite>true</overwrite>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven-war-plugin.version}</version>
<executions>
<execution>
<id>default-war</id>
<phase>package</phase>
<goals>
<goal>war</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
Expand Down Expand Up @@ -557,10 +592,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<source>${java_source.version}</source>
<target>${java_target.version}</target>
</configuration>
</plugin>
<plugin>
Expand All @@ -587,7 +622,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.2</version>
<version>${versions-maven-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-scm-plugin</artifactId>
Expand Down
1 change: 0 additions & 1 deletion scripts/docker-config/setenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ JAVA_OPTS="$JAVA_OPTS -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEA
JAVA_OPTS="$JAVA_OPTS -Duser.timezone=GMT"
JAVA_OPTS="$JAVA_OPTS -Xms${JAVA_MEMORY_MIN} -Xmx${JAVA_MEMORY_MAX}"
JAVA_OPTS="$JAVA_OPTS -XX:+UseG1GC"
JAVA_OPTS="$JAVA_OPTS -XX:+CMSParallelRemarkEnabled"
JAVA_OPTS="$JAVA_OPTS -XX:SurvivorRatio=20"

export JAVA_OPTS
58 changes: 38 additions & 20 deletions scripts/startCouchdbForTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,47 @@
# available under the terms of the Eclipse Public License v2.0
# which is available at http://www.eclipse.org/legal/epl-2.0/

set -e
set -e -o pipefail

NAME=couchdb-for-sw360-testing
COUCHDB_USER=${COUCHDB_USER:-admin}
COUCHDB_PASSWORD=${COUCHDB_PASSWORD:-password}
COUCHDB_HOST=${COUCHDB_HOST:-localhost}

if [[ ! "$(docker ps -q -f name=$NAME)" ]]; then
if netstat -tln | grep -q -e ':5984.*LISTEN' 2>/dev/null; then
echo "port is already bocked, probably by another sw360 deployment"
exit 0
fi

echo "Test container is not running, starting it ..."
docker run \
-e COUCHDB_USER=admin \
-e COUCHDB_PASSWORD=password \
--rm \
-p 5984:5984 \
-d \
--name "$NAME" \
couchdb:3.1
echo "Test container is started and listening on 5984."
else
wait_couchdb() {
# Wait for it to be up
until curl -s http://${COUCHDB_HOST}:5984 >/dev/null 2>&1; do
sleep 1
done

# Check id database is already created
error=$(curl --head http://${COUCHDB_USER}:${COUCHDB_PASSWORD}@${COUCHDB_HOST}:5984/_users | head -n 1 | cut -d' ' -f2)
[ ! "$error" == "404" ] && return

# Couchdb docker no cluster
curl -X PUT http://${COUCHDB_USER}:${COUCHDB_PASSWORD}@${COUCHDB_HOST}:5984/_users
curl -X PUT http://${COUCHDB_USER}:${COUCHDB_PASSWORD}@${COUCHDB_HOST}:5984/_replicator
curl -X PUT http://${COUCHDB_USER}:${COUCHDB_PASSWORD}@${COUCHDB_HOST}:5984/_global_changes
}

if [[ "$(docker ps -q -f name=$NAME)" ]]; then
echo "Test container is running, shutting it down ..."
docker stop "$NAME"
echo "Test container is stopped."
docker kill "$NAME"
fi

echo "Test container is not running, starting it ..."

docker run \
-e COUCHDB_USER="${COUCHDB_USER}" \
-e COUCHDB_PASSWORD="${COUCHDB_PASSWORD}" \
--rm \
-p 5984:5984 \
-d \
--name "$NAME" \
couchdb:3.1

wait_couchdb

echo "Test container is started and listening on 5984."


Loading

0 comments on commit 0cfb802

Please sign in to comment.