Example #1
0
  /**
   * Initializes the reference paths from the given project's dependencies.
   *
   * @param project The maven project.
   * @throws MojoExecutionException
   */
  @SuppressWarnings({"rawtypes", "unchecked"})
  void initReferencePaths(MavenProject project) throws MojoExecutionException {
    List deps = project.getDependencies();

    if (deps == null) {
      debug("not processing project dependencies because they're null: " + project.getName());
      return;
    }

    if (deps.size() == 0) {
      debug(
          "not processing project dependencies because they're zero length: " + project.getName());
      return;
    }

    if (this.referencePaths == null) {
      this.referencePaths = new ArrayList();
    }

    for (Object od : deps) {
      Dependency d = (Dependency) od;

      if (StringUtils.isEmpty(d.getType())) {
        continue;
      }

      if (!d.getType().matches("dll|exe")) {
        continue;
      }

      File file = DependencyUtils.getArtifactFile(super.factory, super.localRepository, d);

      if (file == null) {
        continue;
      }

      if (!this.referencePaths.contains(file.getParentFile())) {
        this.referencePaths.add(file.getParentFile());

        String assemblyName =
            DependencyUtils.getAssemblyName(
                super.factory,
                super.localRepository,
                super.mavenProject.getRemoteArtifactRepositories(),
                super.resolver,
                d);

        DependencyUtils.copyToAssemblyNamedFiles(file, assemblyName);
      }
    }
  }
Example #2
0
  @Override
  String getArgs(int execution) {
    StringBuilder cmdLineBuff = new StringBuilder();

    if (this.noLogo) {
      cmdLineBuff.append("/nologo");
      cmdLineBuff.append(" ");
    }

    if (this.commandFiles != null && this.commandFiles.length != 0) {
      for (File f : this.commandFiles) {
        cmdLineBuff.append("@");
        cmdLineBuff.append(getPath(f));
        cmdLineBuff.append(" ");
      }
    }

    if (this.noAutoResponse) {
      cmdLineBuff.append("/noautoresponse");
    }

    cmdLineBuff.append("/target:");

    for (String s : this.targets) {
      cmdLineBuff.append(quote(s));
      cmdLineBuff.append(";");
    }

    cmdLineBuff.deleteCharAt(cmdLineBuff.length() - 1);
    cmdLineBuff.append(" ");

    for (Object k : this.properties.keySet()) {
      cmdLineBuff.append("/property:");
      cmdLineBuff.append(quote(String.valueOf(k)));
      cmdLineBuff.append("=");
      String s = String.valueOf(this.properties.get(k));
      cmdLineBuff.append(quote(s));
      cmdLineBuff.append(" ");
    }

    cmdLineBuff.deleteCharAt(cmdLineBuff.length() - 1);
    cmdLineBuff.append(" ");

    if (this.loggers != null && this.loggers.length != 0) {
      for (String s : this.loggers) {
        cmdLineBuff.append("/logger:");
        cmdLineBuff.append(quote(s));
        cmdLineBuff.append(" ");
      }
    }

    if (this.distributedLoggers != null && this.distributedLoggers.length != 0) {
      for (String s : this.distributedLoggers) {
        cmdLineBuff.append("/distributedlogger:");
        cmdLineBuff.append(quote(s));
        cmdLineBuff.append(" ");
      }
    }

    if (!StringUtils.isEmpty(this.consoleLoggerParameters)) {
      cmdLineBuff.append("/consoleloggerparameters:");
      cmdLineBuff.append(this.consoleLoggerParameters);
      cmdLineBuff.append(" ");
    }

    if (!StringUtils.isEmpty(this.verbosity)) {
      cmdLineBuff.append("/verbosity:");
      cmdLineBuff.append(this.verbosity);
      cmdLineBuff.append(" ");
    }

    if (this.noConsoleLogger) {
      cmdLineBuff.append("/noconsolelogger");
      cmdLineBuff.append(" ");
    }

    if (this.validate && this.schema == null) {
      cmdLineBuff.append("/validate");
      cmdLineBuff.append(" ");
    } else if (this.schema != null) {
      cmdLineBuff.append("/validate:");
      cmdLineBuff.append(quote(this.schema.getPath()));
      cmdLineBuff.append(" ");
    }

    if (this.ignoreProjectExtensions != null && this.ignoreProjectExtensions.length != 0) {
      cmdLineBuff.append("/ignoreprojectextensions:");

      for (String s : this.ignoreProjectExtensions) {
        cmdLineBuff.append(quote(s));
        cmdLineBuff.append(";");
      }

      cmdLineBuff.deleteCharAt(cmdLineBuff.length() - 1);
      cmdLineBuff.append(" ");
    }

    if (this.fileLogger) {
      cmdLineBuff.append("/fileLogger");
      cmdLineBuff.append(" ");
    }

    if (this.distributedFileLogger) {
      cmdLineBuff.append("/distributedFileLogger");
      cmdLineBuff.append(" ");
    }

    if (this.fileLoggerParameters != null && this.fileLoggerParameters.length != 0) {
      cmdLineBuff.append("/fileloggerparameters:");

      for (String s : this.fileLoggerParameters) {
        cmdLineBuff.append(quote(s));
        cmdLineBuff.append(";");
      }

      cmdLineBuff.deleteCharAt(cmdLineBuff.length() - 1);
      cmdLineBuff.append(" ");
    }

    if (StringUtils.isNotEmpty(this.toolsVersion)) {
      cmdLineBuff.append("/toolsversion:");
      cmdLineBuff.append(quote(this.toolsVersion));
      cmdLineBuff.append(" ");
    }

    if (this.nodeReuse) {
      cmdLineBuff.append("/nodeReuse:true");
      cmdLineBuff.append(" ");
    } else {
      cmdLineBuff.append("/nodeReuse:false");
      cmdLineBuff.append(" ");
    }

    if (this.tempBuildFile == null) {
      cmdLineBuff.append(getPath(getMSBuildProject().getFile()));
    } else {
      cmdLineBuff.append(getPath(this.tempBuildFile));
    }

    String clbs = cmdLineBuff.toString();

    return clbs;
  }