diff --git a/openecomp-be/tools/artifact-copy-plugin/src/main/java/org/openecomp/sdc/onboarding/util/ArtifactHelper.java b/openecomp-be/tools/artifact-copy-plugin/src/main/java/org/openecomp/sdc/onboarding/util/ArtifactHelper.java
index e7ad5da..f51a8aa 100644
--- a/openecomp-be/tools/artifact-copy-plugin/src/main/java/org/openecomp/sdc/onboarding/util/ArtifactHelper.java
+++ b/openecomp-be/tools/artifact-copy-plugin/src/main/java/org/openecomp/sdc/onboarding/util/ArtifactHelper.java
@@ -1,21 +1,68 @@
+/*
+ * Copyright © 2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on a "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.openecomp.sdc.onboarding.util;
 
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
 import java.net.URL;
 import java.nio.file.Files;
 import java.nio.file.Paths;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
+import java.nio.file.StandardCopyOption;
 import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Scanner;
+import java.util.Set;
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.execution.MavenSession;
 import org.apache.maven.project.MavenProject;
 
 public class ArtifactHelper {
 
     private MavenProject project;
+    private MavenSession session;
+    private static Map<String, byte[]> store = new HashMap<>();
+    private static Set<String> terminalModuleCoordinates = new HashSet<>();
+    private String unicornRoot = null;
+    private static File unicornMetaLocation = null;
+    private File tempLocation = Paths.get(System.getProperties().getProperty("java.io.tmpdir")).toFile();
+    private static int snapshotBuildNumber = 0;
+
+    void init(String terminalModuleCoordinate) {
+        setUnicornMetaLocation(getUnicornRootFile(unicornRoot.substring(0, unicornRoot.indexOf('/')), project));
+        setTerminalModuleCoordinates(session.getProjects().get(session.getProjects().size() - 1));
+        terminalModuleCoordinates.add(terminalModuleCoordinate);
+    }
+
+    private static void setUnicornMetaLocation(File file) {
+        unicornMetaLocation = file;
+    }
+
+    static void setSnapshotBuildNumber(int number) {
+        snapshotBuildNumber = number;
+    }
 
     List<ArtifactRepository> getRepositories(boolean snapshotRepo) {
         List<ArtifactRepository> list = new ArrayList<>();
@@ -33,24 +80,75 @@
         return list;
     }
 
+    private void setTerminalModuleCoordinates(MavenProject project) {
+        terminalModuleCoordinates.add(getModuleCoordinate(project));
+    }
+
+    private boolean isModuleTerminal(MavenProject project) {
+        return terminalModuleCoordinates.contains(getModuleCoordinate(project));
+    }
+
+    File getUnicornMetaLocation() {
+        return unicornMetaLocation;
+    }
+
     String getContents(URL path) throws IOException {
         try (InputStream is = path.openStream(); Scanner scnr = new Scanner(is).useDelimiter("\\A")) {
             return scnr.hasNext() ? scnr.next() : "";
         }
     }
 
-    String getChecksum(String filePath, String hashType) throws NoSuchAlgorithmException, IOException {
-        MessageDigest md = MessageDigest.getInstance(hashType);
-        md.update(Files.readAllBytes(Paths.get(filePath)));
-        byte[] hashBytes = md.digest();
-
-        StringBuffer buffer = new StringBuffer();
-        for (byte hashByte : hashBytes) {
-            buffer.append(Integer.toString((hashByte & 0xff) + 0x100, 16).substring(1));
-        }
-        return buffer.toString();
+    void store(String artifactId, byte[] data) {
+        store.put(artifactId, data);
     }
 
+    void deleteAll(File f) {
+        if (!f.exists() && !f.isDirectory()) {
+            return;
+        }
+        for (File file : f.listFiles()) {
+            if (f.isFile()) {
+                file.delete();
+            }
+        }
+    }
+
+    String getModuleCoordinate(MavenProject project) {
+        return project.getGroupId() + ":" + project.getArtifactId();
+    }
+
+    private File getUnicornRootFile(String moduleCoordinate, MavenProject proj) {
+        return getStateFile(moduleCoordinate, proj, unicornRoot);
+    }
+
+    private File getStateFile(String moduleCoordinate, MavenProject proj, String filePath) {
+        return new File(getTopParentProject(moduleCoordinate, proj).getBasedir(),
+                filePath.substring(filePath.indexOf('/') + 1));
+    }
+
+    MavenProject getTopParentProject(String moduleCoordinate, MavenProject proj) {
+        if (getModuleCoordinate(proj).equals(moduleCoordinate) || proj.getParent() == null) {
+            return proj;
+        } else {
+            return getTopParentProject(moduleCoordinate, proj.getParent());
+        }
+    }
+
+    void shutDown(MavenProject project) throws IOException, ClassNotFoundException {
+        File file = new File(unicornMetaLocation, "compileState.dat");
+        Map dataStore = null;
+        if (isModuleTerminal(project) && file.exists()) {
+            try (InputStream is = new FileInputStream(file); ObjectInputStream ois = new ObjectInputStream(is)) {
+                dataStore = HashMap.class.cast(ois.readObject());
+                dataStore.put("shutdownTime", (System.currentTimeMillis() / 1000) * 1000 + snapshotBuildNumber);
+            }
+            try (OutputStream os = new FileOutputStream(file); ObjectOutputStream oos = new ObjectOutputStream(os)) {
+                oos.writeObject(dataStore);
+            }
+            Files.copy(file.toPath(), Paths.get(tempLocation.getAbsolutePath(), file.getName()),
+                    StandardCopyOption.REPLACE_EXISTING);
+        }
+    }
 }
 
 
diff --git a/openecomp-be/tools/artifact-copy-plugin/src/main/java/org/openecomp/sdc/onboarding/util/CalibrateArtifactPlugin.java b/openecomp-be/tools/artifact-copy-plugin/src/main/java/org/openecomp/sdc/onboarding/util/CalibrateArtifactPlugin.java
index 4838608..96f29d0 100644
--- a/openecomp-be/tools/artifact-copy-plugin/src/main/java/org/openecomp/sdc/onboarding/util/CalibrateArtifactPlugin.java
+++ b/openecomp-be/tools/artifact-copy-plugin/src/main/java/org/openecomp/sdc/onboarding/util/CalibrateArtifactPlugin.java
@@ -2,10 +2,6 @@
 
 import java.io.File;
 import java.io.IOException;
-import java.io.UncheckedIOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.nio.file.StandardCopyOption;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
@@ -37,46 +33,26 @@
     @Parameter
     private String version;
     @Parameter
-    private String targetLocation;
-    @Parameter
-    private String name;
-    @Parameter
     private String excludePackaging;
     @Parameter
     private ArtifactHelper artifactHelper;
 
+    @Override
     public void execute() throws MojoExecutionException, MojoFailureException {
         if (project.getPackaging().equals(excludePackaging)) {
             return;
         }
         if (project.getProperties().containsKey(ARTIFACT_COPY_PATH)
                     && project.getProperties().getProperty(ARTIFACT_COPY_PATH) != null) {
-            File f = null;
-            String artifactPath = project.getProperties().getProperty(ARTIFACT_COPY_PATH)
-                                         .startsWith(session.getLocalRepository().getBasedir()) ?
-                                          project.getProperties().getProperty(ARTIFACT_COPY_PATH) :
-                                          project.getProperties().getProperty(ARTIFACT_COPY_PATH)
-                                                 .replace(groupId, groupId.replace('.', '/'));
-            if (artifactPath.startsWith(session.getLocalRepository().getBasedir())) {
-                f = new File(artifactPath);
-            } else {
-                f = new File(session.getLocalRepository().getBasedir(), artifactPath);
-            }
+            File f = new File(project.getProperties().getProperty(ARTIFACT_COPY_PATH));
             if (f.exists()) {
                 project.getArtifact().setFile(f);
             }
         }
-        File file = new File(project.getBuild().getDirectory(), project.getBuild().getFinalName() + ".unicorn");
-        if (file.exists()) {
-            try {
-                Files.copy(file.toPath(), Paths.get(
-                        session.getLocalRepository().getBasedir() + File.separator + project.getGroupId().replace(".",
-                                File.separator) + File.separator + project.getArtifactId() + File.separator
-                                + project.getVersion(), project.getBuild().getFinalName() + ".unicorn"),
-                        StandardCopyOption.REPLACE_EXISTING);
-            } catch (IOException e) {
-                throw new UncheckedIOException(e);
-            }
+        try {
+            artifactHelper.shutDown(project);
+        } catch (IOException | ClassNotFoundException e) {
+            throw new MojoExecutionException("Unexpected Error Occured during shutdown activities", e);
         }
     }
 }
diff --git a/openecomp-be/tools/artifact-copy-plugin/src/main/java/org/openecomp/sdc/onboarding/util/CopyArtifactPlugin.java b/openecomp-be/tools/artifact-copy-plugin/src/main/java/org/openecomp/sdc/onboarding/util/CopyArtifactPlugin.java
deleted file mode 100644
index c89fdd2..0000000
--- a/openecomp-be/tools/artifact-copy-plugin/src/main/java/org/openecomp/sdc/onboarding/util/CopyArtifactPlugin.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright © 2018 European Support Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on a "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.openecomp.sdc.onboarding.util;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.nio.file.StandardCopyOption;
-import java.nio.file.StandardOpenOption;
-import java.security.NoSuchAlgorithmException;
-import java.util.Arrays;
-import java.util.List;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.execution.MavenSession;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugins.annotations.LifecyclePhase;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.plugins.annotations.ResolutionScope;
-import org.apache.maven.project.MavenProject;
-
-@Mojo(name = "copy-helper", threadSafe = true, defaultPhase = LifecyclePhase.CLEAN,
-        requiresDependencyResolution = ResolutionScope.NONE)
-public class CopyArtifactPlugin extends AbstractMojo {
-
-    @Parameter(defaultValue = "${session}")
-    private MavenSession session;
-    @Parameter(defaultValue = "${project}", readonly = true)
-    private MavenProject project;
-    @Parameter
-    private String groupId;
-    @Parameter
-    private String artifactId;
-    @Parameter
-    private String version;
-    @Parameter
-    private String targetLocation;
-    @Parameter
-    private String name;
-    @Parameter
-    private ArtifactHelper artifactHelper;
-
-    @Override
-    public void execute() throws MojoExecutionException, MojoFailureException {
-        if (!project.getProperties().containsKey("resolvedVersion")) {
-            return;
-        }
-        boolean isSnapshot = version.contains("SNAPSHOT");
-        List<ArtifactRepository> artRepoList = artifactHelper.getRepositories(isSnapshot);
-        String resolvedVersion = project.getProperties().getProperty("resolvedVersion");
-        try {
-            if (!version.equals(resolvedVersion)) {
-                boolean result = copyResolvedArtifact(artRepoList, resolvedVersion);
-                if (result && getLog().isInfoEnabled()) {
-                    getLog().info("Data Artifact Copied with " + resolvedVersion);
-                }
-
-            }
-            File orgFile = new File(
-                    session.getLocalRepository().getBasedir() + File.separator + (groupId.replace(".", File.separator))
-                            + File.separator + artifactId + File.separator + version);
-            if (!orgFile.exists()) {
-                return;
-            }
-            File[] list = orgFile.listFiles(t -> t.getName().equals(artifactId + "-" + version + ".jar"));
-            if (list != null && list.length > 0) {
-                String directory = session.getLocalRepository().getBasedir() + File.separator + (groupId.replace(".",
-                        File.separator)) + File.separator + targetLocation + File.separator + version;
-                if (!Paths.get(directory, name).toFile().exists()) {
-                    return;
-                }
-                Files.copy(list[0].toPath(), Paths.get(directory, name), StandardCopyOption.REPLACE_EXISTING);
-                copyTargetArtifact(directory, list[0]);
-            }
-        } catch (IOException | NoSuchAlgorithmException e) {
-            throw new MojoFailureException(e.getMessage(), e);
-        }
-    }
-
-    private void copyTargetArtifact(String directory, File source) throws IOException, NoSuchAlgorithmException {
-        File[] files = new File(directory).listFiles(
-                f -> f.getName().endsWith(".jar") && !f.getName().equals(name) && f.getName().startsWith(
-                        name.substring(0, name.lastIndexOf('-'))));
-        if (files == null || files.length == 0) {
-            return;
-        }
-        Arrays.sort(files, this::compare);
-        File tgtFile = files[files.length - 1];
-        Files.copy(source.toPath(), tgtFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
-        for (String checksumType : Arrays.asList("sha1", "md5")) {
-            File potentialFile = new File(tgtFile.getAbsolutePath() + "." + checksumType);
-            if (potentialFile.exists()) {
-                Files.write(potentialFile.toPath(),
-                        artifactHelper.getChecksum(source.getAbsolutePath(), checksumType).getBytes(),
-                        StandardOpenOption.CREATE);
-            }
-        }
-    }
-
-
-    private boolean copyResolvedArtifact(List<ArtifactRepository> list, String resolvedVersion) {
-        for (ArtifactRepository repo : list) {
-            try {
-                writeContents(
-                        new URL(repo.getUrl() + (groupId.replace('.', '/')) + '/' + artifactId + '/' + version + '/'
-                                        + artifactId + "-" + (version.equals(resolvedVersion) ? version :
-                                                                      version.replace("SNAPSHOT", resolvedVersion))
-                                        + ".jar"));
-                return true;
-            } catch (IOException e) {
-                getLog().debug(e);
-            }
-        }
-        return false;
-    }
-
-
-    private void writeContents(URL path) throws IOException {
-        String directory =
-                session.getLocalRepository().getBasedir() + File.separator + (groupId.replace(".", File.separator))
-                        + File.separator + artifactId + File.separator + version;
-        try (InputStream is = path.openStream()) {
-            Files.copy(is, Paths.get(directory, artifactId + "-" + version + ".jar"),
-                    StandardCopyOption.REPLACE_EXISTING);
-        }
-
-    }
-
-    private int compare(File file1, File file2) {
-        if (file1.lastModified() > file2.lastModified()) {
-            return 1;
-        }
-        if (file1.lastModified() < file2.lastModified()) {
-            return -1;
-        }
-        return 0;
-    }
-
-}
diff --git a/openecomp-be/tools/artifact-copy-plugin/src/main/java/org/openecomp/sdc/onboarding/util/InitializationHelperMojo.java b/openecomp-be/tools/artifact-copy-plugin/src/main/java/org/openecomp/sdc/onboarding/util/InitializationHelperMojo.java
index 22ba506..6fa9b0e 100644
--- a/openecomp-be/tools/artifact-copy-plugin/src/main/java/org/openecomp/sdc/onboarding/util/InitializationHelperMojo.java
+++ b/openecomp-be/tools/artifact-copy-plugin/src/main/java/org/openecomp/sdc/onboarding/util/InitializationHelperMojo.java
@@ -18,7 +18,12 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Method;
 import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
 import java.util.List;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -38,9 +43,11 @@
         requiresDependencyResolution = ResolutionScope.NONE)
 public class InitializationHelperMojo extends AbstractMojo {
 
-    private static final String SKIP_GET = "skipGet";
+    private static final String UNICORN_INITIALIZED = "unicorn_initialized";
     private static final String HTTP = "http";
     private static final String HTTPS = "https";
+    private static final String SNAPSHOT = "SNAPSHOT";
+    private static final String DOT = ".";
 
     @Parameter(defaultValue = "${session}")
     private MavenSession session;
@@ -53,42 +60,36 @@
     @Parameter
     private String version;
     @Parameter
-    private String targetLocation;
-    @Parameter
-    private String name;
-    @Parameter
     private String excludePackaging;
     @Parameter
     private ArtifactHelper artifactHelper;
 
     @Override
     public void execute() throws MojoExecutionException, MojoFailureException {
-        if (System.getProperties().containsKey(SKIP_GET)) {
-            project.getProperties()
-                   .setProperty(SKIP_GET, Boolean.toString(System.getProperties().containsKey(SKIP_GET)));
+        if (System.getProperties().containsKey(UNICORN_INITIALIZED)) {
             return;
-        } else {
-            File orgFile = new File(
-                    session.getLocalRepository().getBasedir() + File.separator + (groupId.replace(".", File.separator))
-                            + File.separator + artifactId + File.separator + version);
-            String resolvedVersion = getResolvedVersion(artifactHelper.getRepositories(version.contains("SNAPSHOT")));
-            project.getProperties().setProperty("resolvedVersion", resolvedVersion);
-            System.getProperties().setProperty(SKIP_GET, Boolean.TRUE.toString());
-            if (resolvedVersion.equals(version) && !orgFile.exists()) {
-                project.getProperties().setProperty(SKIP_GET, Boolean.TRUE.toString());
-            }
         }
+        artifactHelper.init(groupId + ":" + artifactId);
+        artifactHelper.deleteAll(artifactHelper.getUnicornMetaLocation());
+        String resolvedVersion =
+                getResolvedVersion(artifactHelper.getRepositories(version.contains(SNAPSHOT)), artifactId);
+        getLog().info(resolvedVersion.equals(version) ? "Unicorn Initialization Failed!!!" :
+                              "Unicorn Initialization Completed Successfully!!!");
+        System.getProperties().setProperty(UNICORN_INITIALIZED, Boolean.TRUE.toString());
     }
 
-    private String getResolvedVersion(List<ArtifactRepository> list) {
+    private String getResolvedVersion(List<ArtifactRepository> list, String artifactId) {
         Pattern timestampPattern = Pattern.compile(".*<timestamp>(.*)</timestamp>.*");
         Pattern buildNumberPattern = Pattern.compile(".*<buildNumber>(.*)</buildNumber>.*");
+
         String timestamp = null;
         String buildNumber = null;
         for (ArtifactRepository repo : list) {
             try {
                 URL url = new URL(repo.getUrl() + (groupId.replace('.', '/')) + '/' + artifactId + '/' + version
                                           + "/maven-metadata.xml");
+                URL fallbackUrl =
+                        new URL(repo.getUrl() + (groupId.replace('.', '/')) + '/' + artifactId + '/' + version + '/');
                 setProxy(url);
                 String content = artifactHelper.getContents(url);
                 Matcher m = timestampPattern.matcher(content);
@@ -99,16 +100,60 @@
                 if (m.find()) {
                     buildNumber = m.group(1);
                 }
+                timestamp = verifyBuildTimestamp(buildNumber, timestamp, fallbackUrl);
+                if (timestamp != null && buildNumber != null) {
+                    byte[] data = fetchContents(repo.getUrl(), artifactId, timestamp + "-" + buildNumber);
+                    artifactHelper.store(artifactId, data);
+                    getLog().info(artifactId + " Version to be copied is " + timestamp + "-" + buildNumber);
+                    artifactHelper.setSnapshotBuildNumber(Integer.parseInt(buildNumber));
+                    return timestamp + "-" + buildNumber;
+                }
             } catch (IOException e) {
                 getLog().debug(e);
             }
-            if (timestamp != null && buildNumber != null) {
-                return timestamp + "-" + buildNumber;
-            }
         }
         return version;
     }
 
+    private String verifyBuildTimestamp(String buildNumber, String timestamp, URL fallbackUrl) throws IOException {
+        if (buildNumber == null) {
+            return timestamp;
+        }
+        String buildPage = artifactHelper.getContents(fallbackUrl);
+        Pattern verifyPattern = Pattern.compile(
+                ".*" + artifactId + "-" + version.replace(SNAPSHOT, "") + "(.*)" + "-" + buildNumber + ".jar</a>.*");
+        Matcher m = verifyPattern.matcher(buildPage);
+        if (m.find()) {
+            String str = m.group(1);
+            if (!str.equals(timestamp)) {
+                return str;
+            }
+        }
+        return timestamp;
+    }
+
+    private byte[] fetchContents(String repoUrl, String artifactId, String resolvedVersion) throws IOException {
+        File location = Paths.get(project.getBuild().getDirectory(), "build-data").toFile();
+        location.mkdirs();
+        File file = new File(location, artifactId + "-" + (version.equals(resolvedVersion) ? version :
+                                                                   version.replace(SNAPSHOT, resolvedVersion)) + DOT
+                                               + "jar");
+        URL path = new URL(repoUrl + (groupId.replace('.', '/')) + '/' + artifactId + '/' + version + '/' + artifactId
+                                   + "-" + (version.equals(resolvedVersion) ? version :
+                                                    version.replace(SNAPSHOT, resolvedVersion)) + DOT + "jar");
+        try (InputStream is = path.openStream()) {
+            Files.copy(is, file.toPath(), StandardCopyOption.REPLACE_EXISTING);
+        }
+        byte[] data = Files.readAllBytes(file.toPath());
+        try {
+            addJarToClasspath(file);
+        } catch (Exception e) {
+            getLog().error("Error while feeding the build-data into system.", e);
+        }
+
+        return data;
+    }
+
     private void setProxy(URL url) {
         if (url.getProtocol().equalsIgnoreCase(HTTP)) {
             setProperties("http.proxyHost", "http.proxyPort", "http.nonProxyHosts", HTTP);
@@ -121,10 +166,29 @@
             String protocol) {
         for (Proxy proxy : session.getSettings().getProxies()) {
             if (proxy.isActive() && proxy.getProtocol().equalsIgnoreCase(protocol)) {
-                System.setProperty(proxyHostProperty, proxy.getHost());
-                System.setProperty(proxyPortProperty, String.valueOf(proxy.getPort()));
-                System.setProperty(nonProxyHostsProperty, proxy.getNonProxyHosts());
+                if (proxy.getHost() != null && !proxy.getHost().trim().isEmpty()) {
+                    System.setProperty(proxyHostProperty, proxy.getHost());
+                    System.setProperty(proxyPortProperty, String.valueOf(proxy.getPort()));
+                }
+                if (proxy.getNonProxyHosts() != null && !proxy.getNonProxyHosts().trim().isEmpty()) {
+                    System.setProperty(nonProxyHostsProperty, proxy.getNonProxyHosts());
+                }
             }
         }
     }
+
+    public void addJarToClasspath(File jar) throws MojoFailureException {
+        try {
+            ClassLoader cl = ClassLoader.getSystemClassLoader();
+            Class<?> clazz = cl.getClass();
+
+            Method method = clazz.getSuperclass().getDeclaredMethod("addURL", new Class[] {URL.class});
+
+            method.setAccessible(true);
+            method.invoke(cl, new Object[] {jar.toURI().toURL()});
+        } catch (Exception e) {
+            throw new MojoFailureException("Problem while loadig build-data", e);
+        }
+    }
+
 }
diff --git a/openecomp-be/tools/build-data-helper/pom.xml b/openecomp-be/tools/build-data-helper/pom.xml
deleted file mode 100644
index b639c7a..0000000
--- a/openecomp-be/tools/build-data-helper/pom.xml
+++ /dev/null
@@ -1,88 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<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">
-    <modelVersion>4.0.0</modelVersion>
-
-    <groupId>org.openecomp.sdc</groupId>
-    <artifactId>build-data-helper</artifactId>
-
-    <parent>
-        <artifactId>sdc-onboarding</artifactId>
-        <groupId>org.openecomp.sdc</groupId>
-        <version>1.3.0-SNAPSHOT</version>
-        <relativePath>../../../onboarding</relativePath>
-    </parent>
-    <properties>
-        <skipPMD>true</skipPMD>
-        <artifactPathToCopy>${project.groupId}/${project.artifactId}/${project.version}/${project.artifactId}-${project.version}.jar</artifactPathToCopy>
-    </properties>
-<build>
-    <plugins>
-        <plugin>
-            <groupId>org.openecomp.sdc.onboarding</groupId>
-            <artifactId>artifact-copy-plugin</artifactId>
-            <version>${project.version}</version>
-            <executions>
-                <execution>
-                    <id>id3</id>
-                    <goals>
-                        <goal>copy-helper</goal>
-                        <goal>calibrate-artifact-helper</goal>
-                    </goals>
-                    <phase>install</phase>
-                </execution>
-                <execution>
-                    <id>id4</id>
-                    <goals>
-                        <goal>init-artifact-helper</goal>
-                    </goals>
-                </execution>
-            </executions>
-            <configuration>
-                <groupId>org.openecomp.sdc</groupId>
-                <artifactId>build-data-installer</artifactId>
-                <version>${project.version}</version>
-                <targetLocation>build-data-helper</targetLocation>
-                <name>build-data-helper-${project.version}.jar</name>
-                <artifactHelper>
-                    <project>${project}</project>
-                </artifactHelper>
-            </configuration>
-        </plugin>
-        <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-dependency-plugin</artifactId>
-            <version>${maven.dependency.version}</version>
-            <executions>
-                <execution>
-                    <id>id1</id>
-                    <goals>
-                        <goal>get</goal>
-                    </goals>
-                    <phase>clean</phase>
-                    <configuration>
-                        <artifactId>build-data-helper</artifactId>
-                    </configuration>
-                </execution>
-                <execution>
-                    <id>id2</id>
-                    <goals>
-                        <goal>get</goal>
-                    </goals>
-                    <phase>clean</phase>
-                    <configuration>
-                        <artifactId>build-data-installer</artifactId>
-                    </configuration>
-                </execution>
-            </executions>
-            <configuration>
-                <groupId>org.openecomp.sdc</groupId>
-                <version>${project.version}</version>
-                <skip>${skipGet}</skip>
-            </configuration>
-        </plugin>
-    </plugins>
-</build>
-
-</project>
\ No newline at end of file
diff --git a/openecomp-be/tools/build-data-installer/pom.xml b/openecomp-be/tools/build-data-installer/pom.xml
index cf2c91b..2d79e47 100644
--- a/openecomp-be/tools/build-data-installer/pom.xml
+++ b/openecomp-be/tools/build-data-installer/pom.xml
@@ -22,13 +22,6 @@
             <groupId>org.openecomp.sdc.onboarding</groupId>
             <artifactId>pmd-helper-plugin</artifactId>
             <version>${project.version}</version>
-            <dependencies>
-                <dependency>
-                    <groupId>org.openecomp.sdc</groupId>
-                    <artifactId>build-data-helper</artifactId>
-                    <version>${project.version}</version>
-                </dependency>
-            </dependencies>
             <executions>
                 <execution>
                     <goals>
@@ -47,6 +40,29 @@
                 <pmdStateFile>${project.build.outputDirectory}/pmd.dat</pmdStateFile>
             </configuration>
         </plugin>
+        <plugin>
+            <groupId>org.openecomp.sdc.onboarding</groupId>
+            <artifactId>artifact-copy-plugin</artifactId>
+            <version>${project.version}</version>
+            <executions>
+                <execution>
+                    <goals>
+                        <goal>init-artifact-helper</goal>
+                        <goal>calibrate-artifact-helper</goal>
+                    </goals>
+                </execution>
+            </executions>
+            <configuration>
+                <groupId>org.openecomp.sdc</groupId>
+                <artifactId>build-data-installer</artifactId>
+                <version>${project.version}</version>
+                <artifactHelper>
+                    <project>${project}</project>
+                    <session>${session}</session>
+                    <unicornRoot>org.openecomp.sdc:sdc-onboarding/target/build-data</unicornRoot>
+                </artifactHelper>
+            </configuration>
+        </plugin>
     </plugins>
     </build>
 </project>
\ No newline at end of file
diff --git a/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/BuildHelper.java b/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/BuildHelper.java
index 681e5f7..1b1278d 100644
--- a/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/BuildHelper.java
+++ b/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/BuildHelper.java
@@ -16,9 +16,13 @@
 
 package org.openecomp.sdc.onboarding;
 
+import static org.openecomp.sdc.onboarding.Constants.CHECKSUM;
+import static org.openecomp.sdc.onboarding.Constants.COLON;
+import static org.openecomp.sdc.onboarding.Constants.DOT;
 import static org.openecomp.sdc.onboarding.Constants.JAVA_EXT;
 import static org.openecomp.sdc.onboarding.Constants.UNICORN;
 
+import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
@@ -40,16 +44,44 @@
 import java.util.Optional;
 import java.util.concurrent.ForkJoinPool;
 import java.util.concurrent.RecursiveTask;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
 import java.util.stream.Collectors;
 import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.project.MavenProject;
 
 class BuildHelper {
 
+    private static Log logger;
+
+    private static Map<String, String> store = new HashMap<>();
+
     private BuildHelper() {
         // donot remove.
     }
 
+    static void setLogger(Log log) {
+        logger = log;
+    }
+
+    static String getSnapshotSignature(File snapshotFile, String moduleCoordinate, String version) {
+        String key = moduleCoordinate + ":" + version;
+        String signature = store.get(key);
+        if (signature != null) {
+            return signature;
+        }
+        try {
+            signature = new String(fetchSnapshotSignature(snapshotFile, version));
+            store.put(key, signature);
+            return signature;
+        } catch (IOException ioe) {
+            logger.debug(ioe);
+            return version;
+        }
+
+    }
+
     static long getChecksum(File file, String fileType) {
         try {
             return readSources(file, fileType).hashCode();
@@ -76,8 +108,7 @@
         if (file.exists()) {
             List<File> list = Files.walk(Paths.get(file.getAbsolutePath()))
                                    .filter(JAVA_EXT.equals(fileType) ? BuildHelper::isRegularJavaFile :
-                                                   Files::isRegularFile).map(p -> p.toFile())
-                                   .collect(Collectors.toList());
+                                                   Files::isRegularFile).map(Path::toFile).collect(Collectors.toList());
             source.putAll(ForkJoinPool.commonPool()
                                       .invoke(new FileReadTask(list.toArray(new File[0]), file.getAbsolutePath())));
         }
@@ -143,7 +174,8 @@
 
     static Optional<String> getArtifactPathInLocalRepo(String repoPath, MavenProject project, byte[] sourceChecksum)
             throws MojoFailureException {
-
+        store.put(project.getGroupId() + COLON + project.getArtifactId() + COLON + project.getVersion(),
+                new String(sourceChecksum));
         URI uri = null;
         try {
             uri = new URI(repoPath + (project.getGroupId().replace('.', '/')) + '/' + project.getArtifactId() + '/'
@@ -155,9 +187,8 @@
         File[] list = f.listFiles(t -> t.getName().equals(project.getArtifactId() + "-" + project.getVersion() + "."
                                                                   + project.getPackaging()));
         if (list != null && list.length > 0) {
-            File checksumFile = new File(list[0].getParentFile(), project.getBuild().getFinalName() + "." + UNICORN);
             try {
-                if (checksumFile.exists() && Arrays.equals(sourceChecksum, Files.readAllBytes(checksumFile.toPath()))) {
+                if (Arrays.equals(sourceChecksum, fetchSnapshotSignature(list[0], project.getVersion()))) {
                     return Optional.of(list[0].getAbsolutePath());
                 }
             } catch (IOException e) {
@@ -167,12 +198,27 @@
         return Optional.empty();
     }
 
+    private static byte[] fetchSnapshotSignature(File file, String version) throws IOException {
+        byte[] data = Files.readAllBytes(file.toPath());
+        try (ByteArrayInputStream bais = new ByteArrayInputStream(data);
+             JarInputStream jis = new JarInputStream(bais)) {
+            JarEntry entry = null;
+            while ((entry = jis.getNextJarEntry()) != null) {
+                if (entry.getName().equals(UNICORN + DOT + CHECKSUM)) {
+                    byte[] sigStore = new byte[1024];
+                    return new String(sigStore, 0, jis.read(sigStore, 0, 1024)).getBytes();
+                }
+            }
+        }
+        return version.getBytes();
+    }
+
     static <T> Optional<T> readState(String fileName, Class<T> clazz) {
         try (InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName);
              ObjectInputStream ois = new ObjectInputStream(is)) {
             return Optional.of(clazz.cast(ois.readObject()));
         } catch (Exception ignored) {
-            //ignore. it is taken care.
+            logger.debug(ignored);
             return Optional.empty();
         }
     }
diff --git a/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/BuildState.java b/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/BuildState.java
index ead6e7b..1ce60a6 100644
--- a/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/BuildState.java
+++ b/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/BuildState.java
@@ -28,9 +28,13 @@
 import static org.openecomp.sdc.onboarding.Constants.SKIP_MAIN_SOURCE_COMPILE;
 
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
+import java.nio.file.Paths;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -39,36 +43,59 @@
 import java.util.Set;
 import java.util.function.Function;
 import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.project.MavenProject;
 
 public class BuildState {
 
+    private static final String SHUTDOWN_TIME = "shutdownTime";
+
     private static Map<String, Map> compileDataStore = new HashMap<>();
     private static Map<String, Object> moduleBuildData = new HashMap<>();
     private static Map<String, Object> resourceBuildData = new HashMap<>();
     private static Map<String, Artifact> artifacts = new HashMap<>();
     private static Set<String> executeTestsIfDependsOnStore = new HashSet<>();
     private static Set<String> pmdExecutedInRun = new HashSet<>();
+    private static File stateFileLocation =
+            new File(Paths.get(System.getProperties().getProperty("java.io.tmpdir")).toFile(), "compileState.dat");
 
     private static File compileStateFile;
     private MavenProject project;
     private String compileStateFilePath;
+    private static Log logger;
 
     static {
         initializeStore();
         Optional<HashMap> masterStore = readState("compile.dat", HashMap.class);
         compileDataStore = masterStore.isPresent() ? masterStore.get() : compileDataStore;
+        if (stateFileLocation.exists()) {
+            HashMap dat = loadState(stateFileLocation);
+            if (swapStates((HashMap<?, ?>) compileDataStore, dat)) {
+                compileDataStore = dat;
+            }
+        }
     }
 
-    void init() {
+    private static void setLogger(Log log) {
+        logger = log;
+    }
+
+    void init(Log log) {
+        setLogger(log);
         artifacts.clear();
         for (Artifact artifact : project.getArtifacts()) {
             if (artifact.isSnapshot() && JAR.equals(artifact.getType())) {
                 artifacts.put(artifact.getGroupId() + ":" + artifact.getArtifactId(), artifact);
             }
         }
-        compileStateFile =
-                getCompileStateFile(compileStateFilePath.substring(0, compileStateFilePath.indexOf('/')), project);
+        if (compileStateFile == null) {
+            setCompileStateFile(
+                    getCompileStateFile(compileStateFilePath.substring(0, compileStateFilePath.indexOf('/')), project));
+        }
+    }
+
+    private static void setCompileStateFile(File file) {
+        compileStateFile = file;
     }
 
     static void initializeStore() {
@@ -124,12 +151,13 @@
         Long lastTime = Long.class.cast(compileDataStore.get(FULL_BUILD_DATA).put(moduleCoordinates, buildTime));
         try {
             if (lastTime == null || !lastTime.equals(buildTime)) {
-                if (!project.getProperties().containsKey(SKIP_MAIN_SOURCE_COMPILE)) {
+                boolean skipMainCompile = project.getProperties().containsKey(SKIP_MAIN_SOURCE_COMPILE);
+                if (!skipMainCompile) {
                     writeCompileState();
                 }
             }
         } catch (IOException ignored) {
-            // ignored. No need to handle. System will take care.
+            logger.debug(ignored);
         }
     }
 
@@ -140,7 +168,7 @@
                 compileDataStore.get(FULL_RESOURCE_BUILD_DATA).put(moduleCoordinates, buildTime);
                 writeCompileState();
             } catch (IOException ignored) {
-                // ignored. No need to handle. System will take care.
+                logger.debug(ignored);
             }
         }
     }
@@ -182,7 +210,7 @@
                  ObjectOutputStream ois = new ObjectOutputStream(fos)) {
                 ois.writeObject(dataToSave);
             } catch (IOException ignored) {
-                //ignored. do nothing. system will take care.
+                logger.debug(ignored);
             }
         }
     }
@@ -209,10 +237,11 @@
     boolean isCompileMust(String moduleCoordinates, Collection<String> dependencies) {
         for (String d : dependencies) {
             if (artifacts.containsKey(d) && JAR.equals(artifacts.get(d).getType())) {
-                if (artifacts.get(d).getVersion().equals(project.getVersion()) && getBuildTime(d) == 0) {
-                    System.out.println(ANSI_YELLOW + "[WARNING:]" + "You have module[" + d
-                                               + "] not locally compiled even once, please compile your project once daily from root to have reliable build results."
-                                               + ANSI_COLOR_RESET);
+                boolean versionEqual = artifacts.get(d).getVersion().equals(project.getVersion());
+                if (versionEqual && getBuildTime(d) == 0) {
+                    logger.warn(ANSI_YELLOW + "[WARNING:]" + "You have module[" + d
+                                        + "] not locally compiled even once, please compile your project once daily from root to have reliable build results."
+                                        + ANSI_COLOR_RESET);
                     return true;
                 }
             }
@@ -248,4 +277,25 @@
         return false;
     }
 
+    private static HashMap loadState(File file) {
+        try (InputStream is = new FileInputStream(file); ObjectInputStream ois = new ObjectInputStream(is)) {
+            return HashMap.class.cast(ois.readObject());
+        } catch (Exception e) {
+            logger.debug(e);
+            return new HashMap<>();
+        }
+    }
+
+    private static boolean swapStates(HashMap repo, HashMap last) {
+        Long repoTime = repo.get(SHUTDOWN_TIME) == null ? 0 : (Long) repo.get(SHUTDOWN_TIME);
+        Long lastTime = last.get(SHUTDOWN_TIME) == null ? 0 : (Long) last.get(SHUTDOWN_TIME);
+        long repoBuildNumber = repoTime / 1000;
+        long lastBuildNumber = lastTime / 1000;
+        if (repoBuildNumber != lastBuildNumber) {
+            return false;
+        }
+        return Long.compare(repoTime, lastTime) < 0;
+    }
+
+
 }
diff --git a/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/Constants.java b/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/Constants.java
index fb69cce..195b356 100644
--- a/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/Constants.java
+++ b/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/Constants.java
@@ -22,7 +22,6 @@
     public static final String UNICORN = "unicorn";
     public static final String EMPTY_STRING = "";
     public static final String PREFIX = System.getProperties().contains(UNICORN) ? EMPTY_STRING : UNICORN;
-    ;
     public static final String JACOCO_SKIP = "jacoco.skip";
     public static final String FORK_COUNT = "fork.count";
     public static final String FORK_MODE = "fork.mode";
@@ -39,8 +38,10 @@
     public static final String SKIP_MAIN_SOURCE_COMPILE = PREFIX + "skipMainSourceCompile";
     public static final String SKIP_TEST_SOURCE_COMPILE = PREFIX + "skipTestSourceCompile";
     public static final String MAIN_CHECKSUM = "mainChecksum";
+    public static final String CHECKSUM = "checksum";
     public static final String TEST_CHECKSUM = "testChecksum";
     public static final String RESOURCE_CHECKSUM = "resourceChecksum";
+    public static final String TEST_RESOURCE_CHECKSUM = "testResourceChecksum";
     public static final String MAIN_SOURCE_CHECKSUM = "mainSourceChecksum";
     public static final String TEST_SOURCE_CHECKSUM = "testSourceChecksum";
     public static final String GENERATED_SOURCE_CHECKSUM = "generatedSourceChecksum";
@@ -65,4 +66,6 @@
 
     private Constants() {
     }
+
+
 }
diff --git a/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/InitializationHelperMojo.java b/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/InitializationHelperMojo.java
index 9aa48b2..42ddc65 100644
--- a/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/InitializationHelperMojo.java
+++ b/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/InitializationHelperMojo.java
@@ -64,12 +64,15 @@
         project.getProperties().setProperty(SKIP_PMD, Boolean.TRUE.toString());
 
         if (System.getProperties().containsKey(UNICORN)) {
-            buildState.init();
+            buildState.init(getLog());
+            BuildHelper.setLogger(getLog());
         } else {
             project.getProperties().setProperty("skipMainSourceCompile", Boolean.FALSE.toString());
             project.getProperties().setProperty("skipTestSourceCompile", Boolean.FALSE.toString());
         }
 
+
     }
 
+
 }
diff --git a/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/PreCompileHelperMojo.java b/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/PreCompileHelperMojo.java
index 5924271..e97b172 100644
--- a/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/PreCompileHelperMojo.java
+++ b/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/PreCompileHelperMojo.java
@@ -18,9 +18,11 @@
 
 import static org.openecomp.sdc.onboarding.BuildHelper.getArtifactPathInLocalRepo;
 import static org.openecomp.sdc.onboarding.BuildHelper.getChecksum;
+import static org.openecomp.sdc.onboarding.BuildHelper.getSnapshotSignature;
 import static org.openecomp.sdc.onboarding.BuildHelper.getSourceChecksum;
 import static org.openecomp.sdc.onboarding.BuildHelper.readState;
 import static org.openecomp.sdc.onboarding.Constants.ANY_EXT;
+import static org.openecomp.sdc.onboarding.Constants.CHECKSUM;
 import static org.openecomp.sdc.onboarding.Constants.COLON;
 import static org.openecomp.sdc.onboarding.Constants.DOT;
 import static org.openecomp.sdc.onboarding.Constants.EMPTY_JAR;
@@ -47,6 +49,7 @@
 import static org.openecomp.sdc.onboarding.Constants.TEST;
 import static org.openecomp.sdc.onboarding.Constants.TEST_CHECKSUM;
 import static org.openecomp.sdc.onboarding.Constants.TEST_ONLY;
+import static org.openecomp.sdc.onboarding.Constants.TEST_RESOURCE_CHECKSUM;
 import static org.openecomp.sdc.onboarding.Constants.TEST_RESOURCE_ONLY;
 import static org.openecomp.sdc.onboarding.Constants.TEST_SOURCE_CHECKSUM;
 import static org.openecomp.sdc.onboarding.Constants.UNICORN;
@@ -120,6 +123,7 @@
     private long mainChecksum = 0;
     private long testChecksum = 0;
     private long resourceChecksum = 0;
+    private long testResourceChecksum = 0;
     Optional<String> artifactPath;
 
     static {
@@ -139,9 +143,10 @@
             return;
         }
         resourceChecksum = getChecksum(mainResourceLocation, ANY_EXT);
+        testResourceChecksum = getChecksum(testResourceLocation, ANY_EXT);
         project.getProperties().setProperty(RESOURCE_CHECKSUM, String.valueOf(resourceChecksum));
+        project.getProperties().setProperty(TEST_RESOURCE_CHECKSUM, String.valueOf(testResourceChecksum));
         byte[] sourceChecksum = calculateChecksum(mainChecksum, resourceChecksum).getBytes();
-        boolean instrumented = isCurrentModuleInstrumented();
         artifactPath = getArtifactPathInLocalRepo(session.getLocalRepository().getUrl(), project, sourceChecksum);
 
         boolean isFirstBuild = buildState.getBuildTime(moduleCoordinates) == 0 || !artifactPath.isPresent();
@@ -150,7 +155,11 @@
         Map<String, Object> lastTimeModuleBuildData = buildState.readModuleBuildData();
         resourceBuildData = getCurrentResourceBuildData();
         Map<String, Object> lastTimeResourceBuildData = buildState.readResourceBuildData();
-
+        generateSyncAlert(lastTimeResourceBuildData != null && (
+                !resourceBuildData.get(MAIN).equals(lastTimeResourceBuildData.get(MAIN)) || !resourceBuildData.get(TEST)
+                                                                                                              .equals(lastTimeResourceBuildData
+                                                                                                                              .get(TEST)
+                                                                                                                              .toString())));
         boolean buildDataSameWithPreviousBuild =
                 isBuildDataSameWithPreviousBuild(lastTimeModuleBuildData, moduleBuildData);
         boolean resourceMainBuildDataSameWithPreviousBuild =
@@ -163,6 +172,7 @@
 
         boolean testToBeCompiled =
                 lastTimeModuleBuildData == null || !moduleBuildData.get(TEST).equals(lastTimeModuleBuildData.get(TEST));
+        final boolean instrumented = isCurrentModuleInstrumented();
         setMainBuildAttribute(mainToBeCompiled, testToBeCompiled);
         generateSignature(sourceChecksum);
         setTestBuild(resourceDataSame, resourceMainBuildDataSameWithPreviousBuild, testToBeCompiled, mainToBeCompiled);
@@ -182,9 +192,9 @@
 
     private void generateSignature(byte[] sourceChecksum) {
         try {
-            Paths.get(project.getBuild().getDirectory()).toFile().mkdirs();
-            Files.write(Paths.get(project.getBuild().getDirectory(), project.getBuild().getFinalName() + DOT + UNICORN),
-                    sourceChecksum, StandardOpenOption.CREATE);
+            Paths.get(project.getBuild().getOutputDirectory()).toFile().mkdirs();
+            Files.write(Paths.get(project.getBuild().getOutputDirectory(), UNICORN + DOT + CHECKSUM), sourceChecksum,
+                    StandardOpenOption.CREATE);
         } catch (IOException e) {
             throw new UncheckedIOException(e);
         }
@@ -323,7 +333,7 @@
         }
     }
 
-    private Map<String, Object> getCurrentModuleBuildData() {
+    private Map<String, Object> getCurrentModuleBuildData() throws MojoExecutionException {
         Map<String, Object> moduleBuildData = new HashMap<>();
         moduleBuildData.put(MAIN, new HashMap<String, String>());
         moduleBuildData.put(TEST, new HashMap<String, String>());
@@ -339,18 +349,16 @@
             return moduleBuildData;
         }
         for (Artifact dependency : project.getArtifacts()) {
-            String fileNme = dependency.getFile().getName();
+            String version = dependency.isSnapshot() ? getSnapshotSignature(dependency.getFile(),
+                    dependency.getGroupId() + COLON + dependency.getArtifactId(), dependency.getVersion()) :
+                                     dependency.getVersion();
             if (excludeDependencies.contains(dependency.getScope())) {
                 HashMap.class.cast(moduleBuildData.get(TEST))
-                             .put(dependency.getGroupId() + COLON + dependency.getArtifactId(),
-                                     fileNme.endsWith(dependency.getVersion() + DOT + JAR) ? dependency.getVersion() :
-                                             fileNme);
+                             .put(dependency.getGroupId() + COLON + dependency.getArtifactId(), version);
                 continue;
             }
             HashMap.class.cast(moduleBuildData.get(MAIN))
-                         .put(dependency.getGroupId() + COLON + dependency.getArtifactId(),
-                                 fileNme.endsWith(dependency.getVersion() + DOT + JAR) ? dependency.getVersion() :
-                                         fileNme);
+                         .put(dependency.getGroupId() + COLON + dependency.getArtifactId(), version);
         }
         return moduleBuildData;
     }
@@ -408,7 +416,7 @@
     private Map<String, Object> getCurrentResourceBuildData() {
         HashMap<String, Object> resourceBuildStateData = new HashMap<>();
         resourceBuildStateData.put(MAIN, project.getProperties().getProperty(RESOURCE_CHECKSUM));
-        resourceBuildStateData.put(TEST, getChecksum(testResourceLocation, ANY_EXT));
+        resourceBuildStateData.put(TEST, project.getProperties().getProperty(TEST_RESOURCE_CHECKSUM));
         resourceBuildStateData.put("dependency", getDependencies().hashCode());
         return resourceBuildStateData;
     }
@@ -445,6 +453,14 @@
         if (!checksum.equals(checksumMap.get(moduleCoordinates)) || isPMDMandatory(project.getArtifacts())) {
             project.getProperties().setProperty(SKIP_PMD, Boolean.FALSE.toString());
             BuildState.recordPMDRun(moduleCoordinates);
+            generateSyncAlert(!checksum.equals(checksumMap.get(moduleCoordinates)));
+        }
+    }
+
+    private void generateSyncAlert(boolean required) {
+        if (required) {
+            getLog().warn(
+                    "\u001B[33m\u001B[1m UNICORN Alert!!! Source code in version control system for this module is different than your local one. \u001B[0m");
         }
     }
 }
diff --git a/openecomp-be/tools/pmd-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/pmd/VerifyHelperMojo.java b/openecomp-be/tools/pmd-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/pmd/VerifyHelperMojo.java
index 87c9ca5..c80951f 100644
--- a/openecomp-be/tools/pmd-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/pmd/VerifyHelperMojo.java
+++ b/openecomp-be/tools/pmd-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/pmd/VerifyHelperMojo.java
@@ -17,9 +17,9 @@
 package org.openecomp.sdc.onboarding.pmd;
 
 import static org.openecomp.sdc.onboarding.pmd.PMDHelperUtils.getStateFile;
+import static org.openecomp.sdc.onboarding.pmd.PMDHelperUtils.isReportEmpty;
 import static org.openecomp.sdc.onboarding.pmd.PMDHelperUtils.readCurrentPMDState;
 import static org.openecomp.sdc.onboarding.pmd.PMDHelperUtils.writeCurrentPMDState;
-import static org.openecomp.sdc.onboarding.pmd.PMDHelperUtils.isReportEmpty;
 
 import java.io.File;
 import java.io.IOException;
@@ -28,7 +28,6 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.stream.Collectors;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
@@ -78,28 +77,19 @@
         if (project.getPackaging().equals(excludePackaging)) {
             return;
         }
-        if (moduleCoordinates.equals(persistingModuleCoordinates)) {
-            if (pmdStateFile.exists()) {
-                pmdStateFile.delete();
-            }
-        }
-        if (pmdCurrentStateFile == null) {
-            pmdCurrentStateFile =
-                    getStateFile(pmdCurrentStateFilePath.substring(0, pmdCurrentStateFilePath.indexOf('/')), project,
-                            pmdCurrentStateFilePath);
-            pmdCurrentStateFile.getParentFile().mkdirs();
-            pmdReportFile.getParentFile().mkdirs();
-        }
-        if (PMDState.getHistoricState() != null && PMDState.getHistoricState().isEmpty()) {
-            getLog().error("PMD Check is skipped. problem while loading data.");
-        }
-        if (Boolean.FALSE.equals(Boolean.valueOf(project.getProperties().getProperty(SKIP_PMD))) && !isReportEmpty(pmdReportFile)) {
+        init();
+        warnDataIssuesIfAny();
+
+        if (Boolean.FALSE.equals(Boolean.valueOf(project.getProperties().getProperty(SKIP_PMD))) && !isReportEmpty(
+                pmdReportFile)) {
             Map<String, List<Violation>> data = readCurrentPMDState(pmdCurrentStateFile);
             Map<String, List<Violation>> cv = readCurrentModulePMDReport();
             data.putAll(cv);
+            boolean error = false;
             if (!PMDState.getHistoricState().isEmpty() && !PMDHelperUtils
                                                                    .evaluateCodeQuality(PMDState.getHistoricState(), cv,
                                                                            pmdFailureReportLocation, getLog())) {
+                error = true;
                 if (validatePMDReport) {
                     throw new MojoFailureException(
                             "PMD Failures encountered. Build halted. For details refer " + pmdFailureReportLocation
@@ -111,39 +101,63 @@
                                     + " and address them before committing this code in Version Control System. \u001B[0m");
                 }
             }
+            String moduleChecksum = project.getProperties().getProperty("mainChecksum") + ":" + project.getProperties()
+                                                                                                       .getProperty(
+                                                                                                               "testChecksum");
+            data = reinitializeIfNeeded(!error, data);
+
             Map<String, Object> checksumStore = HashMap.class.cast(data);
-            checksumStore.put(moduleCoordinates,
-                    project.getProperties().getProperty("mainChecksum") + ":" + project.getProperties()
-                                                                                       .getProperty("testChecksum"));
-            writeCurrentPMDState(pmdCurrentStateFile, data);
+            if (!moduleChecksum.equals(checksumStore.get(moduleCoordinates))) {
+                checksumStore.put(moduleCoordinates, moduleChecksum);
+                writeCurrentPMDState(pmdCurrentStateFile, data);
+            }
         }
         if (Boolean.FALSE.equals(Boolean.valueOf(project.getProperties().getProperty(SKIP_PMD)))) {
-            if (isReportEmpty(pmdReportFile)){
+            if (isReportEmpty(pmdReportFile)) {
                 HashMap data = HashMap.class.cast(readCurrentPMDState(pmdCurrentStateFile));
                 data.put(moduleCoordinates,
-                        project.getProperties().getProperty("mainChecksum") + ":" + project.getProperties()
-                                                                                           .getProperty("testChecksum"));
+                        project.getProperties().getProperty("mainChecksum") + ":" + project.getProperties().getProperty(
+                                "testChecksum"));
                 writeCurrentPMDState(pmdCurrentStateFile, data);
             }
             pmdReportFile.delete();
         }
+        removeProcessFiles();
+
+    }
+
+    private void removeProcessFiles() {
+        if (moduleCoordinates.equals(persistingModuleCoordinates) && pmdStateFile.exists()) {
+            pmdStateFile.delete();
+        }
         if (pmdTargetLocation.exists()) {
             pmdTargetLocation.delete();
         }
+    }
 
+    private void init() {
+        if (pmdCurrentStateFile == null) {
+            setPmdCurrentStateFile(
+                    getStateFile(pmdCurrentStateFilePath.substring(0, pmdCurrentStateFilePath.indexOf('/')), project,
+                            pmdCurrentStateFilePath));
+
+            pmdReportFile.getParentFile().mkdirs();
+        }
+    }
+
+    private static void setPmdCurrentStateFile(File file) {
+        pmdCurrentStateFile = file;
+        pmdCurrentStateFile.getParentFile().mkdirs();
     }
 
     private Map<String, List<Violation>> readCurrentModulePMDReport() {
         try {
             PMDState.reset(compiledFilesList, compiledTestFilesList, moduleCoordinates);
             if (pmdReportFile.exists()) {
-                boolean isFirst = true;
-                for (String line : Files.lines(pmdReportFile.toPath()).collect(Collectors.toList())) {
-                    if (isFirst) {
-                        isFirst = false;
-                    } else {
-                        PMDState.addViolation(line, moduleCoordinates);
-                    }
+                List<String> lines = Files.readAllLines(pmdReportFile.toPath());
+                lines.remove(0);
+                for (String line : lines) {
+                    PMDState.addViolation(line, moduleCoordinates);
                 }
             }
         } catch (IOException ioe) {
@@ -152,4 +166,18 @@
         return PMDState.getState();
     }
 
+    private void warnDataIssuesIfAny() {
+        if (PMDState.getHistoricState() != null && PMDState.getHistoricState().isEmpty()) {
+            getLog().error("PMD Check is skipped. problem while loading data.");
+        }
+    }
+
+    private Map<String, List<Violation>> reinitializeIfNeeded(boolean required, Map<String, List<Violation>> orig) {
+        if (required) {
+            return readCurrentPMDState(pmdCurrentStateFile);
+        } else {
+            return orig;
+        }
+    }
+
 }
