From 579a88d19c023b5374d09e025d4841613d0f9a5f Mon Sep 17 00:00:00 2001 From: michaelpede Date: Tue, 26 Oct 2021 09:46:00 -0700 Subject: [PATCH] Updates to fix generic build --- .gitignore | 1 + Dockerfile | 5 +++- docker-compose.yml | 1 + docker/docker-builder | 4 ++- docker/scripts/build.sh | 29 ++++++++++++++----- pom.xml | 2 +- .../data/definition/FieldDefinition.java | 2 +- 7 files changed, 33 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index af21487..ee006df 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ target bin *.iml *.bak +.env* classes .DS_Store *.local diff --git a/Dockerfile b/Dockerfile index 0d85f0a..d539d10 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,11 @@ -FROM tomcat:latest +FROM tomcat:9 +#FROM tomcat:latest ENV JPDA_ADDRESS="*:8000" ENV JPDA_TRANSPORT="dt_socket" + #Not needed while volume mapped for development #COPY ./target/RESOservice-1.0.war /usr/local/tomcat/webapps/ +#COPY ./target/RESODataDictionary-1.7.metadata-report.json /usr/local/tomcat/webapps/ CMD ["catalina.sh", "jpda", "run"] diff --git a/docker-compose.yml b/docker-compose.yml index 84085c0..6688b7d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,6 +15,7 @@ services: - SQL_PASSWORD - SQL_CONNECTION_STR - SQL_DB_DRIVER + - CERT_REPORT_FILENAME volumes: - ./target:/usr/local/tomcat/webapps # depends_on: diff --git a/docker/docker-builder b/docker/docker-builder index e64a568..015f791 100644 --- a/docker/docker-builder +++ b/docker/docker-builder @@ -1,7 +1,9 @@ FROM ubuntu:20.10 WORKDIR /usr/src/app +ARG DEBIAN_FRONTEND=noninteractive +RUN apt-get update && apt-get install -y wget openjdk-8-jdk curl pip maven docker-compose -RUN apt-get update && apt-get install -y wget curl pip maven docker-compose +RUN update-java-alternatives -s java-1.8.0-openjdk-amd64 CMD ./docker/scripts/build.sh diff --git a/docker/scripts/build.sh b/docker/scripts/build.sh index 8860342..328bf96 100644 --- a/docker/scripts/build.sh +++ b/docker/scripts/build.sh @@ -1,13 +1,18 @@ #!/bin/bash REAL_VAR0=`readlink -f $0` -HOME_DIR=`dirname ${REAL_VAR0}` +HOME_DIR_OLD=`dirname ${REAL_VAR0}` +HOME_DIR=/usr/src/app TEMP_DIR="${HOME_DIR}/temp" SQL_DIR="${HOME_DIR}/sql" # Ensure we have directories set up [ -d "${TEMP_DIR}" ] && echo "temp directory found." || mkdir ${TEMP_DIR} [ -d "${SQL_DIR}" ] && echo "sql directory found." || mkdir ${SQL_DIR} +if [ ! -f "${HOME_DIR}/.env" ] +then + cp "${HOME_DIR}/env-default" "${HOME_DIR}/.env" +fi if [ -z "${SQL_HOST}" ] then @@ -19,24 +24,34 @@ then then echo "CURL not installed. Exiting build." exit + else + curl -L https://raw.githubusercontent.com/RESOStandards/web-api-commander/main/src/main/resources/RESODataDictionary-1.7.metadata-report.json --output RESODataDictionary-1.7.metadata-report.json fi + else + wget https://raw.githubusercontent.com/RESOStandards/web-api-commander/main/src/main/resources/RESODataDictionary-1.7.metadata-report.json -O RESODataDictionary-1.7.metadata-report.json fi - java -jar temp/web-api-commander.jar --generateReferenceDDL --useKeyNumeric > sql/reso-reference-ddl-dd-1.7.numeric-keys.sql - - # The following lines should be independent of the SQL logic. - java -jar temp/web-api-commander.jar --generateResourceInfoModels - mv ResourceInfoModels/* src/main/java/org/reso/service/data/definition/ + java -jar temp/web-api-commander.jar --generateReferenceDDL --useKeyNumeric >sql/reso-reference-ddl-dd-1.7.numeric-keys.sql else COMPOSE_FILE="docker-compose.yml" fi +#VERSION=6.5.1 +#wget https://services.gradle.org/distributions/gradle-${VERSION}-bin.zip -P /tmp +#unzip -d /opt/gradle /tmp/gradle-${VERSION}-bin.zip +#ln -s /opt/gradle/gradle-${VERSION} /opt/gradle/latest + +#/opt/gradle/latest/bin/gradle build +#mkdir target +#cp build/libs/RESOservice-1.0.war ./target/ +#cp RESODataDictionary-1.7.metadata-report.json ./target/ + if ! mvn compile then echo "Maven could not be found." exit else mvn package + cp RESODataDictionary-1.7.metadata-report.json ./target/ fi - diff --git a/pom.xml b/pom.xml index b86acc4..3d9961e 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ javax.servlet javax.servlet-api - 4.0.1 + 3.1.0 provided diff --git a/src/main/java/org/reso/service/data/definition/FieldDefinition.java b/src/main/java/org/reso/service/data/definition/FieldDefinition.java index f065268..7addce2 100644 --- a/src/main/java/org/reso/service/data/definition/FieldDefinition.java +++ b/src/main/java/org/reso/service/data/definition/FieldDefinition.java @@ -61,7 +61,7 @@ public class FieldDefinition extends ResourceInfo list.add(fieldInfo); fieldInfo = new FieldInfo("FieldName", EdmPrimitiveTypeKind.String.getFullQualifiedName()); - fieldInfo.addAnnotation("The name of the field as expressed in the payload. For OData APIs, this field MUST meet certain naming requirements and should be consistent with what’s advertised in the OData XML metadata (to be verified in certification). ", "Core.Description"); + fieldInfo.addAnnotation("The name of the field as expressed in the payload. For OData APIs, this field MUST meet certain naming requirements and should be consistent with what's advertised in the OData XML metadata (to be verified in certification). ", "Core.Description"); list.add(fieldInfo); fieldInfo = new FieldInfo("DisplayName", EdmPrimitiveTypeKind.String.getFullQualifiedName());