protected void addPersistentUnitCache(JavaCommand cmd) {
   if (persistentunitcache != null) {
     cmd.systemProperty(
         "gwt.persistentunitcache", String.valueOf(persistentunitcache.booleanValue()));
   }
   if (persistentunitcachedir != null) {
     cmd.systemProperty("gwt.persistentunitcachedir", persistentunitcachedir.getAbsolutePath());
   }
 }
 protected void addArgumentGen(JavaCommand cmd) {
   if (this.genParam) {
     if (!this.gen.exists()) {
       this.gen.mkdirs();
     }
     cmd.arg("-gen", this.gen.getAbsolutePath());
   }
 }
  /**
   * Add sources.jar artifacts for project dependencies listed as compileSourcesArtifacts. This is a
   * GWT hack to avoid packaging java source files into JAR when sharing code between server and
   * client. Typically, some domain model classes or business rules may be packaged as a separate
   * Maven module. With GWT packaging this requires to distribute such classes with code, that may
   * not be desirable.
   *
   * <p>The hack can also be used to include utility code from external librariries that may not
   * have been designed for GWT.
   */
  protected void addCompileSourceArtifacts(JavaCommand cmd) throws MojoExecutionException {
    if (compileSourcesArtifacts == null) {
      return;
    }
    for (String include : compileSourcesArtifacts) {
      List<String> parts = new ArrayList<String>();
      parts.addAll(Arrays.asList(include.split(":")));
      if (parts.size() == 2) {
        // type is optional as it will mostly be "jar"
        parts.add("jar");
      }
      String dependencyId = StringUtils.join(parts.iterator(), ":");
      boolean found = false;

      for (Artifact artifact : getProjectArtifacts()) {
        getLog().debug("compare " + dependencyId + " with " + artifact.getDependencyConflictId());
        if (artifact.getDependencyConflictId().equals(dependencyId)) {
          getLog().debug("Add " + dependencyId + " sources.jar artifact to compile classpath");
          Artifact sources =
              resolve(
                  artifact.getGroupId(),
                  artifact.getArtifactId(),
                  artifact.getVersion(),
                  "jar",
                  "sources");
          cmd.addToClasspath(sources.getFile());
          found = true;
          break;
        }
      }
      if (!found)
        getLog()
            .warn(
                "Declared compileSourcesArtifact was not found in project dependencies "
                    + dependencyId);
    }
  }
 protected void addArgumentDeploy(JavaCommand cmd) {
   if (deploy != null) {
     cmd.arg("-deploy").arg(String.valueOf(deploy));
   }
 }