コード例 #1
0
  private boolean ensureNoLocalModifications()
      throws ComponentLookupException, ScmException, MojoExecutionException {

    if (!Boolean.getBoolean("sesat.mojo.localModifications.ignore")) {

      final ScmManager scmManager = (ScmManager) container.lookup(ScmManager.ROLE);

      loadPomProject();

      final StatusScmResult result =
          scmManager.status(
              scmManager.makeScmRepository(project.getScm().getDeveloperConnection()),
              new ScmFileSet(pomProject.getBasedir()));

      if (!result.isSuccess()) {

        getLog().error(result.getCommandOutput());
        throw new MojoExecutionException("Failed to ensure checkout has no modifications");
      }

      if (0 < result.getChangedFiles().size()) {

        throw new MojoExecutionException(
            "Your checkout has local modifications. "
                + "Server deploy can *only* be done with a clean workbench.");
      }

      return result.isSuccess() && 0 == result.getChangedFiles().size();
    }
    return true; // sesat.mojo.localModifications.ignore
  }
コード例 #2
0
  private void tagDeploy() throws ComponentLookupException, ScmException {

    final ScmManager scmManager = (ScmManager) container.lookup(ScmManager.ROLE);
    final String date = new SimpleDateFormat("yyyyMMddHHmm").format(now);

    loadPomProject();

    final TagScmResult result =
        scmManager.tag(
            scmManager.makeScmRepository(project.getScm().getDeveloperConnection()),
            new ScmFileSet(pomProject.getBasedir()), // TODO server-side copy
            profile + "-deployments/" + date + "-" + project.getArtifactId(),
            "sesat " + profile + " deployment");

    if (!result.isSuccess()) {
      throw new ScmException(result.getCommandOutput());
    }
  }