fix get-edgent-jars for j7 and android
diff --git a/samples/.gitignore b/samples/.gitignore
new file mode 100644
index 0000000..ea30b70
--- /dev/null
+++ b/samples/.gitignore
@@ -0,0 +1,42 @@
+
+# get-edgent-jars generated outout
+get-edgent-jars-project
+
+*.class
+
+# Local developers toolchain
+/toolchains-local.xml
+
+# Exclude the maven-wrapper.jar
+.mvn/wrapper/maven-wrapper.jar
+
+# More generated artifacts
+target/
+/test/svt/lib
+/release-edgent
+/reports
+/.gradle/
+build/
+/externalJars
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.war
+*.ear
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+
+# IntelliJ Idea
+.idea/
+*.iml
+
+# Eclipse
+.classpath
+.project
+.settings/
+
+# Emacs
+*~
diff --git a/samples/console/.gitignore b/samples/console/.gitignore
index a50dafe..d3cd401 100644
--- a/samples/console/.gitignore
+++ b/samples/console/.gitignore
@@ -1,2 +1,2 @@
# sample's output file
-consoleUrl.txt
\ No newline at end of file
+consoleUrl.txt
diff --git a/samples/cron/.gitignore b/samples/cron/.gitignore
index ed3454e..127f7ab 100644
--- a/samples/cron/.gitignore
+++ b/samples/cron/.gitignore
@@ -1,3 +1,3 @@
# mkcrontab generated output
-startapp.cron
\ No newline at end of file
+startapp.cron
diff --git a/samples/get-edgent-jars.sh b/samples/get-edgent-jars.sh
index c00e72d..46a2bbf 100755
--- a/samples/get-edgent-jars.sh
+++ b/samples/get-edgent-jars.sh
@@ -17,7 +17,6 @@
#
## Get the Apache Edgent jars and their transitive external dependencies.
-## Requires that maven (mvn) be installed and on the PATH
##
## By default get the Edgent java8 platform jars for the script's default Edgent version.
##
@@ -28,13 +27,17 @@
## --file gav-file get only the specified artifacts. Not restricted to Edgent jars.
## The Edgent version is substituted for all instances of '{EV}'
## Lines that begin with '#' are ignored.
+## --mvn mvn-cmd use mvn-cmd instead of "./mvnw"
##
## Creates the directory get-edgent-jars-project and a maven project in it
-USAGE="usage: [--platform {java8|java7|android}] [--version edgent-version] [--artifacts csv-gav-list] [--file gav-file]"
+USAGE="usage: [--platform {java8|java7|android}] [--version edgent-version] [--artifacts csv-gav-list] [--file gav-file] [--mvn mvn-cmd]"
set -e
+SAMPLES_DIR=`(cd $(dirname $0); pwd)`
+MVN_CMD=${SAMPLES_DIR}/mvnw
+
EDGENT_PLATFORM=java8
EDGENT_VERSION=1.2.0
SLF4J_VERSION=1.7.12
@@ -56,6 +59,9 @@
OPT_GAVS_FILE=$2; shift; shift
OPT_GAVS=`sed -e '/^#/d' < ${OPT_GAVS_FILE}`
fi
+if [ "$1" = "--mvn" -a $# -gt 1 ]; then
+ MVN_CMD=$2; shift; shift
+fi
if [ $# != 0 ]; then
echo "$USAGE"
exit 1
@@ -132,11 +138,19 @@
###########################
if [ ! -d ${PROJ_DIR} ]; then
echo "##### Generating maven project ${PROJ_DIR}..."
- mvn -B archetype:generate \
+ # ensure a standalone pom (no parent) to avoid unwanted inherited deps
+ TMP_PROJ=${PROJ_DIR}-tmp
+ mkdir ${TMP_PROJ}
+ cd ${TMP_PROJ}
+ ${MVN_CMD} -B archetype:generate \
-DarchetypeGroupId=org.apache.maven.archeTypes \
+ -DarchetypeArtifactId=maven-archetype-quickstart \
-DgroupId=org.apache.edgent.tools \
-DartifactId=${PROJ_DIR} \
-Dversion=1.0
+ cd ..
+ mv ${TMP_PROJ}/${PROJ_DIR} ${PROJ_DIR}
+ rmdir ${TMP_PROJ}
cp ${PROJ_DIR}/pom.xml ${PROJ_DIR}/pom.xml.orig
else
cp ${PROJ_DIR}/pom.xml.orig ${PROJ_DIR}/pom.xml
@@ -175,12 +189,16 @@
###########################
echo
echo "##### Retrieving jars into local maven repo..."
-mvn clean compile
+${MVN_CMD} clean compile
###########################
echo
echo "##### Copying jars..."
-mvn dependency:copy-dependencies -DincludeScope=runtime
+# if someone screws up j7 or android deps, uncomment the following and
+# it will help identify wrong jars that are getting included / copied
+# (and otherwise overwriting each other).
+#DEBUG_DEPS=-Dmdep.prependGroupId=true
+${MVN_CMD} dependency:copy-dependencies -DincludeScope=runtime ${DEBUG_DEPS}
DEPS_SRC_DIR=target/dependency
EDGENT_DEPS_DIR=${EDGENT_PLATFORM}/edgent-jars
@@ -191,7 +209,7 @@
cp ${DEPS_SRC_DIR}/* ${EXT_DEPS_DIR}
-for i in `find ${EXT_DEPS_DIR} -name 'edgent-*.*ar'`; do
+for i in `find ${EXT_DEPS_DIR} -name '*edgent-*.*ar'`; do
mv $i ${EDGENT_DEPS_DIR}
done
diff --git a/samples/pom.xml b/samples/pom.xml
index 794cc89..966abf8 100644
--- a/samples/pom.xml
+++ b/samples/pom.xml
@@ -35,7 +35,7 @@
<name>Apache Edgent: Samples</name>
<properties>
- <edgent.platform></edgent.platform>
+ <edgent.platform/> <!-- set by -Pplatform-* -->
<edgent.base.groupId>org.apache.edgent${edgent.platform}</edgent.base.groupId>
<edgent.version>1.2.0-SNAPSHOT</edgent.version>
diff --git a/samples/template/pom.xml b/samples/template/pom.xml
index 593b958..fd8e7d4 100644
--- a/samples/template/pom.xml
+++ b/samples/template/pom.xml
@@ -21,11 +21,11 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <parent>
+ <!--parent>
<groupId>org.apache</groupId>
<artifactId>apache</artifactId>
<version>18</version>
- </parent>
+ </parent-->
<!-- your Edgent Application coordinates here -->
<groupId>com.mycompany.app</groupId>