Skip to content

Commit

Permalink
[#360] build : remove models from jar
Browse files Browse the repository at this point in the history
  • Loading branch information
bamthomas committed Feb 28, 2020
1 parent f3c9bcd commit d11a5fe
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 23 deletions.
10 changes: 3 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,7 @@ jobs:
- run: mvn -pl datashare-db liquibase:update
- run: mvn test
- run: mvn -Dmaven.test.skip=true package
- run:
name: copy jar into dist dir
command: |
mkdir datashare-dist/target/datashare-dist-$CIRCLE_TAG/lib
cp datashare-dist/target/datashare-dist-$CIRCLE_TAG.jar datashare-dist/target/datashare-dist-$CIRCLE_TAG/lib/

- persist_to_workspace:
root: /tmp/datashare
paths:
Expand Down Expand Up @@ -147,8 +143,8 @@ jobs:
- run:
name: build and push docker image
command: |
cp -a /tmp/datashare/dist/ /tmp/datashare/datashare-dist/target/datashare-dist-$CIRCLE_TAG/app
docker build -t icij/datashare:${CIRCLE_TAG} /tmp/datashare/datashare-dist/target/datashare-dist-$CIRCLE_TAG/
cp -a /tmp/datashare/dist/ /tmp/datashare/datashare-dist/target/datashare-dist-$CIRCLE_TAG-all/app
docker build -t icij/datashare:${CIRCLE_TAG} /tmp/datashare/datashare-dist/target/datashare-dist-$CIRCLE_TAG-all/
docker login -u ${DOCKER_USER} -p ${DOCKER_PASS}
docker push icij/datashare:${CIRCLE_TAG}
Expand Down
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
VERSION = $(shell cat pom.xml | grep '<version>[0-9.]\+' | sed 's/<version>\([0-9.]\+\)<\/version>/\1/g' | tr -d '[:space:]')
DIST_TARGET=datashare-dist/target/datashare-dist-$(VERSION)
DIST_TARGET=datashare-dist/target/datashare-dist-$(VERSION)-all
PATH_TO_APP_DIST=../datashare-client/dist/

$(DIST_TARGET): dist
Expand All @@ -25,8 +25,6 @@ release:

docker: $(DIST_TARGET)
cp -a $(PATH_TO_APP_DIST) $(DIST_TARGET)/app || exit 1
mkdir -p $(DIST_TARGET)/lib
cp datashare-dist/target/*.jar $(DIST_TARGET)/lib/
docker build -t icij/datashare:$(VERSION) $(DIST_TARGET)

unit:
Expand Down
34 changes: 23 additions & 11 deletions datashare-dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</parent>

<artifactId>datashare-dist</artifactId>
<packaging>pom</packaging>
<packaging>jar</packaging>

<dependencies>
<dependency>
Expand Down Expand Up @@ -84,18 +84,30 @@
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<archive>
<manifest>
<mainClass>org.icij.datashare.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<shadedClassifierName>all</shadedClassifierName>
<shadedArtifactAttached>true</shadedArtifactAttached>
<transformers>
<!--remove models from jar see mitie -->
<transformer implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
<resource>.dat</resource>
</transformer>
</transformers>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
Expand Down
2 changes: 1 addition & 1 deletion datashare-dist/src/main/docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ if [ "$1" = 'sh' ];
then
exec "$@"
else
CLASSPATH=$(find /home/datashare/lib -name "*.jar")
CLASSPATH=$(find /home/datashare/lib/ -name '*.jar' | xargs | sed 's/ /:/g')
exec java "${DS_JAVA_OPTS}" -DPROD_MODE=true -cp "/home/datashare/dist/:${CLASSPATH}" ${MAIN_CLASS} "$@"
fi
1 change: 0 additions & 1 deletion datashare-nlp/datashare-nlp-ixapipe/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@


<build>

<resources>
<resource>
<!-- Exclude models from jar -->
Expand Down

0 comments on commit d11a5fe

Please sign in to comment.