Skip to content

Commit

Permalink
Merge pull request #66 from AtlasOfLivingAustralia/64-automate-the-bu…
Browse files Browse the repository at this point in the history
…ild-and-deployment-of-sensitive-species-dataxml

#64 automate the build and deployment of sensitive species dataxml
  • Loading branch information
nickdos authored Oct 12, 2024
2 parents 61cb2af + a5826d3 commit 8e64a00
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
17 changes: 7 additions & 10 deletions createxml.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Script to generate the sensitivie-species.xml file.
# Script to generate the sensitive-species.xml file.
#
# Requires a config file to be present in /data/sds/sds-config.properties
# Code must be built with `mvn clean install`
Expand All @@ -10,19 +10,16 @@
debug=0
cd target

# These two lines are used to find the most recent version jar files (by filename sort) in target dir (with and without assembly)
jar_file=$(find . -maxdepth 1 -type f -regex '\./sds.*\.jar' | sort | grep -v 'assembly' | head -n 1)
assembly_file=$(find . -maxdepth 1 -type f -regex '\./sds.*\.jar' | sort | grep 'assembly' | head -n 1)
# This line is used to find the most recent version shaded jar file in the target dir
shaded_jar_file=$(find . -maxdepth 1 -type f -regex '\./sds.*\-shaded.jar' | sort | grep -v 'assembly' | head -n 1)

if [ -z "$assembly_file" ] && [ -z "$jar_file" ]; then
if [ -z "$shaded_jar_file" ]; then
echo "No file matching the pattern was found."
elif [ $debug -eq 1 ]; then
echo "File found: $jar_file"
echo "File found: $assembly_file"
echo "File found: ${shaded_jar_file}"
else
# Create the lib directory and run the SensitiveSpeciesXmlBuilder "main" class
jar xf $assembly_file lib lib
java -Xmx2g -Xms2g -classpath "${jar_file}:lib/*" au.org.ala.sds.util.SensitiveSpeciesXmlBuilder # > sensitive-species-data.xml
# Run the SensitiveSpeciesXmlBuilder "main" class
java -Xmx2g -Xms2g -classpath ${shaded_jar_file} au.org.ala.sds.util.SensitiveSpeciesXmlBuilder > sensitive-species-data.xml
fi

cd ..
23 changes: 23 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,29 @@
</execution>
</executions>
</plugin>
<!-- Plugin to create the JAR with dependencies -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>au.org.ala.sds.util.SensitiveSpeciesXmlBuilder</mainClass>
</transformer>
</transformers>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>shaded</shadedClassifierName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

0 comments on commit 8e64a00

Please sign in to comment.