Serializer-xml build fail when building with option '-DskipTests' fixed.

Change-Id: I635a5f619f691d7a9e1626f9cd780ed7d20e3a8d
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/DataModelUtils.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/DataModelUtils.java
index c9dba2c..1d2ebe0 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/DataModelUtils.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/DataModelUtils.java
@@ -886,6 +886,9 @@
                 fileOutputStream.close();
                 inputStream.close();
                 nodes.addAll(deSerializeDataModel(serializedFile.toString()));
+                //As of now only one metadata files will be there so if we
+                // found one then we should break the loop.
+                break;
             }
         }
         jar.close();
@@ -931,6 +934,9 @@
                 }
                 fileOutputStream.close();
                 inputStream.close();
+                //As of now only one metadata files will be there so if we
+                // found one then we should break the loop.
+                break;
             }
         }
         jar.close();
diff --git a/runtime/pom.xml b/runtime/pom.xml
index 56e61ed..7ca9b7e 100644
--- a/runtime/pom.xml
+++ b/runtime/pom.xml
@@ -113,9 +113,15 @@
                         </goals>
                         <configuration>
                             <target>
-                                <delete>
+                                <delete includeemptydirs="true">
                                     <fileset dir="${project.build.outputDirectory}/org/onosproject/yang/gen" includes="**/*"/>
                                 </delete>
+                                <delete includeemptydirs="true">
+                                    <fileset dir="${project.build.outputDirectory}/yang" includes="**/*"/>
+                                </delete>
+                                <delete includeemptydirs="true" failonerror="false">
+                                    <fileset dir="${project.build.outputDirectory}/Temp" includes="**/*"/>
+                                </delete>
                             </target>
                         </configuration>
                     </execution>
diff --git a/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultYangModelRegistry.java b/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultYangModelRegistry.java
index 1ba79c6..98595f3 100644
--- a/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultYangModelRegistry.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultYangModelRegistry.java
@@ -255,12 +255,13 @@
      * pkg string contains the java package and java name of the module
      * generated class in lower case.
      *
-     * @param pkg interface class pkg
+     * @param pkg       interface class pkg
+     * @param isFromDnb true when request has come from data tree builder
      * @return YANG schema node
      */
-    public YangSchemaNode getForInterfaceFilePkg(String pkg) {
+    public YangSchemaNode getForInterfaceFilePkg(String pkg, boolean isFromDnb) {
         YangSchemaNode node = pkgKeyStore.get(pkg);
-        if (node == null) {
+        if (node == null && !isFromDnb) {
             log.error("{} not found.", pkg);
         }
         return node;
diff --git a/runtime/src/main/java/org/onosproject/yang/runtime/impl/ModIdToRscIdConverter.java b/runtime/src/main/java/org/onosproject/yang/runtime/impl/ModIdToRscIdConverter.java
index 772e6a6..70ba78e 100644
--- a/runtime/src/main/java/org/onosproject/yang/runtime/impl/ModIdToRscIdConverter.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/impl/ModIdToRscIdConverter.java
@@ -162,7 +162,8 @@
         // because the next string will be rpc name in received from fetch
         // package method.
         modPkg.deleteCharAt(modPkg.lastIndexOf(PERIOD));
-        YangNode node = (YangNode) reg.getForInterfaceFilePkg(modPkg.toString());
+        YangNode node = (YangNode) reg.getForInterfaceFilePkg(modPkg.toString(),
+                                                              true);
         if (node != null) {
             isInputOrOutput = true;
             modNode = node;
@@ -184,7 +185,7 @@
             modPkg.append(PERIOD);
             //In this case this package will be of module fetchNode.
             modPkg.append(strArray[i]);
-            modNode = reg.getForInterfaceFilePkg(modPkg.toString());
+            modNode = reg.getForInterfaceFilePkg(modPkg.toString(), false);
         }
         return modNode;
     }
diff --git a/serializers/xml/pom.xml b/serializers/xml/pom.xml
index 164e49b..2e19395 100644
--- a/serializers/xml/pom.xml
+++ b/serializers/xml/pom.xml
@@ -81,9 +81,15 @@
                         </goals>
                         <configuration>
                             <target>
-                                <delete>
+                                <delete includeemptydirs="true">
                                     <fileset dir="${project.build.outputDirectory}/org/onosproject/yang/gen" includes="**/*"/>
                                 </delete>
+                                <delete includeemptydirs="true">
+                                    <fileset dir="${project.build.outputDirectory}/yang" includes="**/*"/>
+                                </delete>
+                                <delete includeemptydirs="true" failonerror="false">
+                                    <fileset dir="${project.build.outputDirectory}/Temp" includes="**/*"/>
+                                </delete>
                             </target>
                         </configuration>
                     </execution>