build yang plugin if it wasn't already

Change-Id: I7e50abed1dd7f419e1e392f76fdf68dd2408060c
diff --git a/tools/dev/bin/patch-yang-libs b/tools/dev/bin/patch-yang-libs
index 7e11968..d5a6161 100755
--- a/tools/dev/bin/patch-yang-libs
+++ b/tools/dev/bin/patch-yang-libs
@@ -41,6 +41,10 @@
 EOF
 done
 
+YANG_PLUGIN_SRC=$YANG_TOOLS_ROOT/compiler/plugin/buck/target/onos-yang-compiler-buck-plugin-$SVER.jar
+if [ ! -f "$YANG_PLUGIN_SRC" ]; then
+    mvn -f $YANG_TOOLS_ROOT/pom.xml -am -pl :onos-yang-compiler-buck-plugin install -DskipTests -Dcheckstyle.skip
+fi
 # Patch the YANG BUCK plugin
-cp $YANG_TOOLS_ROOT/compiler/plugin/buck/target/onos-yang-compiler-buck-plugin-$SVER.jar \
+cp -p $YANG_PLUGIN_SRC \
         $ONOS_ROOT/bin/plugins/yang.jar