protected void addBuild() {
    Build build = model.getBuild();
    if (build == null) {
      build = new Build();
    }

    if (bwEdition.equals("cf")) {
      boolean cfplugin = false;
      List<Plugin> plugins = build.getPlugins();
      for (Plugin plg : plugins) {
        if (plg.getArtifactId().equals("cf-maven-plugin")) {
          cfplugin = true;
        }
      }

      // Add only if doesn't exist
      if (!cfplugin) {
        addPCFWithSkipMavenPlugin(build);
      }
    } else if (bwEdition.equals("docker")) {
      boolean dockerPlugin = false;
      List<Plugin> plugins = build.getPlugins();
      for (Plugin plg : plugins) {
        if (plg.getArtifactId().equals("docker-maven-plugin")) {
          dockerPlugin = true;
        }
      }

      if (!dockerPlugin) {
        // Add docker and platform plugins if doesn't exist
        addDockerWithSkipMavenPlugin(build);

        String platform = "";
        for (BWModule module : project.getModules()) {
          if (module.getType() == BWModuleType.Application) {
            platform = module.getBwDockerModule().getPlatform();
          }
        }

        if (platform.equals("K8S")) {
          addDockerK8SMavenPlugin(build, true);
        } else if (platform.equals("Mesos")) {

        } else if (platform.equals("Swarm")) {

        }
      }
    }
    model.setBuild(build);
  }
  @Override
  public boolean install() {
    if (!this.isInstalled()) {
      for (DirectoryResource folder : this.getSourceFolders()) {
        folder.mkdirs();
      }

      // FIXME WOW this needs to be simplified somehow...
      MavenCoreFacet maven = project.getFacet(MavenCoreFacet.class);
      Model pom = maven.getPOM();
      Build build = pom.getBuild();
      if (build == null) {
        build = new Build();
      }
      List<Plugin> plugins = build.getPlugins();
      Plugin javaSourcePlugin = null;
      for (Plugin plugin : plugins) {
        if ("org.apache.maven.plugins".equals(plugin.getGroupId())
            && "maven-compiler-plugin".equals(plugin.getArtifactId())) {
          javaSourcePlugin = plugin;
        }
      }

      if (javaSourcePlugin == null) {
        javaSourcePlugin = new Plugin();
        // FIXME this should find the most recent version using DependencyResolver
        javaSourcePlugin.setGroupId("org.apache.maven.plugins");
        javaSourcePlugin.setArtifactId("maven-compiler-plugin");
        javaSourcePlugin.setVersion("2.3.2");

        try {
          Xpp3Dom dom =
              Xpp3DomBuilder.build(
                  new ByteArrayInputStream(
                      "<configuration><source>1.6</source><target>1.6</target></configuration>"
                          .getBytes()),
                  "UTF-8");

          javaSourcePlugin.setConfiguration(dom);
        } catch (Exception e) {
          throw new ProjectModelException(e);
        }
      }

      build.addPlugin(javaSourcePlugin);
      pom.setBuild(build);
      maven.setPOM(pom);
    }
    return true;
  }
  public void testProjectInheritance() throws Exception {
    File localRepo = getLocalRepositoryPath();

    System.out.println("Local repository is at: " + localRepo.getAbsolutePath());

    File pom0 = new File(localRepo, "p0/pom.xml");
    File pom1 = new File(pom0.getParentFile(), "p1/pom.xml");
    File pom2 = new File(pom1.getParentFile(), "p2/pom.xml");
    File pom3 = new File(pom2.getParentFile(), "p3/pom.xml");
    File pom4 = new File(pom3.getParentFile(), "p4/pom.xml");
    File pom5 = new File(pom4.getParentFile(), "p5/pom.xml");

    System.out.println("Location of project-4's POM: " + pom4.getPath());

    // load everything...
    MavenProject project0 = getProject(pom0);
    MavenProject project1 = getProject(pom1);
    MavenProject project2 = getProject(pom2);
    MavenProject project3 = getProject(pom3);
    MavenProject project4 = getProject(pom4);
    MavenProject project5 = getProject(pom5);

    assertEquals("p4", project4.getName());

    // ----------------------------------------------------------------------
    // Value inherited from p3
    // ----------------------------------------------------------------------

    assertEquals("2000", project4.getInceptionYear());

    // ----------------------------------------------------------------------
    // Value taken from p2
    // ----------------------------------------------------------------------

    assertEquals("mailing-list", project4.getMailingLists().get(0).getName());

    // ----------------------------------------------------------------------
    // Value taken from p1
    // ----------------------------------------------------------------------

    assertEquals("scm-url/p2/p3/p4", project4.getScm().getUrl());

    // ----------------------------------------------------------------------
    // Value taken from p4
    // ----------------------------------------------------------------------

    assertEquals("Codehaus", project4.getOrganization().getName());

    // ----------------------------------------------------------------------
    // Value taken from super model
    // ----------------------------------------------------------------------

    assertEquals("4.0.0", project4.getModelVersion());

    Build build = project4.getBuild();
    List plugins = build.getPlugins();

    Map validPluginCounts = new HashMap();

    String testPluginArtifactId = "maven-compiler-plugin";

    // this is the plugin we're looking for.
    validPluginCounts.put(testPluginArtifactId, 0);

    // these are injected if -DperformRelease=true
    validPluginCounts.put("maven-deploy-plugin", 0);
    validPluginCounts.put("maven-javadoc-plugin", 0);
    validPluginCounts.put("maven-source-plugin", 0);

    Plugin testPlugin = null;

    for (Iterator it = plugins.iterator(); it.hasNext(); ) {
      Plugin plugin = (Plugin) it.next();

      String pluginArtifactId = plugin.getArtifactId();

      if (!validPluginCounts.containsKey(pluginArtifactId)) {
        fail("Illegal plugin found: " + pluginArtifactId);
      } else {
        if (pluginArtifactId.equals(testPluginArtifactId)) {
          testPlugin = plugin;
        }

        Integer count = (Integer) validPluginCounts.get(pluginArtifactId);

        if (count.intValue() > 0) {
          fail("Multiple copies of plugin: " + pluginArtifactId + " found in POM.");
        } else {
          count = count.intValue() + 1;

          validPluginCounts.put(pluginArtifactId, count);
        }
      }
    }

    List executions = testPlugin.getExecutions();

    assertEquals(1, executions.size());
  }