# http://www.eclipse.org/legal/epl-v10.html
##############################################################################
-FILE_NAME=`echo $P2ZIP_URL | awk -F'/' '{ print $NF }'`
-VERSION=`echo $P2ZIP_URL | awk -F'/' '{ print $(NF-1) }'`
+if [[ $P2ZIP_URL == "" ]]; then
+ P2ZIP_URL=opendaylight.snapshot/$(find . -name "*.zip" -type f -exec ls "{}" + | head -1)
+ FILE_NAME=`echo $P2ZIP_URL | awk -F'/' '{ print $NF }'`
+ RELEASE_PATH="snapshot"
+else
+ FILE_NAME=`echo $P2ZIP_URL | awk -F'/' '{ print $NF }'`
+ VERSION=`echo $P2ZIP_URL | awk -F'/' '{ print $(NF-1) }'`
+ RELEASE_PATH="release/$VERSION"
+ wget --quiet $P2ZIP_URL -O $FILE_NAME
+fi
-wget $P2ZIP_URL -O $FILE_NAME
+# If we detect a snapshot build then release to a snapshot repo
+# YangIDE has indicated that the only want the latest snapshot released to
+# the snapshot directory.
+if echo $P2ZIP_URL | grep opendaylight.snapshot; then
+ RELEASE_PATH="snapshot"
+fi
cat > ${WORKSPACE}/pom.xml <<EOF
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<serverId>opendaylight-p2</serverId>
<repositoryUrl>https://nexus.opendaylight.org/service/local/repositories/p2repos/content-compressed</repositoryUrl>
<file>$FILE_NAME</file>
- <repositoryPath>org.opendaylight.$PROJECT/$VERSION</repositoryPath>
+ <repositoryPath>org.opendaylight.$PROJECT/$RELEASE_PATH</repositoryPath>
</configuration>
</execution>
</executions>