Package org.moxie

Examples of org.moxie.MoxieException


        r.close();
      } else {
        log.verbose("No site-excludes found");
      }
    } catch (IOException ioe) {
      throw new MoxieException("IOException loading site-excludes");
    }
  }
View Full Code Here


        }
        is.closeEntry();
      }
    } catch (Exception e) {
      console.error("Failed to merge service definitions!");
      throw new MoxieException(e);
    } finally {
      // close input file
      if (is != null) {
        try {
          is.close();
View Full Code Here

            project.groupId = fields[0];
            project.artifactId = fields[1];
            project.version = fields[2];
            break;
          default:
            throw new MoxieException("Illegal parameter " + args);
          }
        }
      }
     
      InputStream is = getClass().getResourceAsStream(MessageFormat.format("/archetypes/{0}.moxie", project.type));
View Full Code Here

        config.setString("branch""master", "remote", "origin");
        config.setString("branch""master", "merge", "refs/heads/master");
        try {
        config.save();
      } catch (IOException e) {
        throw new MoxieException(e);
      }
      }

      // prepare a common gitignore file
      StringBuilder sb = new StringBuilder();
      sb.append("/.directory\n");
      sb.append("/.DS_STORE\n");
      sb.append("/.DS_Store\n");
      sb.append("/.settings\n");
      sb.append("/bin\n");
      sb.append("/build\n");
      sb.append("/ext\n");
      sb.append("/target\n");
      sb.append("/tmp\n");
      sb.append("/temp\n");
      if (!newProject.eclipse.includeClasspath()) {
        // ignore hard-coded .classpath
        sb.append("/.classpath\n")
      }
      FileUtils.writeContent(new File(newProject.dir, ".gitignore"), sb.toString());
     
      AddCommand add = git.add();
      add.addFilepattern("build.xml");
      add.addFilepattern("build.moxie");
      add.addFilepattern(".gitignore");
      if (newProject.eclipse.includeProject()) {
        add.addFilepattern(".project")
      }
      if (newProject.eclipse.includeClasspath()) {
        // MOXIE_HOME relative dependencies in .classpath
        add.addFilepattern(".classpath")
      }
        if (newProject.idea.includeProject()) {
            add.addFilepattern(".project");
        }
        if (newProject.idea.includeClasspath()) {
            // MOXIE_HOME relative dependencies in .iml
            add.addFilepattern("*.iml");
        }
      try {
        add.call();
        CommitCommand commit = git.commit();
        PersonIdent moxie = new PersonIdent("Moxie", "moxie@localhost");
        commit.setAuthor(moxie);
        commit.setCommitter(moxie);
        commit.setMessage("Project structure created");
        commit.call();
      } catch (Exception e) {
        throw new MoxieException(e);
      }
    }
View Full Code Here

              }
              return baseUrl + repo;
            }
          }
        } catch (Exception e) {
          throw new MoxieException(e);
        }
      }
      return url;
    }
View Full Code Here

        this.stage = stage;
        break;
      }
    }
    if (stage ==  null) {
      throw new MoxieException(MessageFormat.format("Illegal stage {0}", value));
    }
  }
View Full Code Here

        this.incrementNumber = number;
        break;
      }
    }
    if (stage ==  null) {
      throw new MoxieException(MessageFormat.format("Illegal stage {0}", value));
    }
  }
View Full Code Here

   
    MaxmlMap map = null;
    try {
      map = Maxml.parse(moxieFile);
    } catch (MaxmlException e) {
      throw new MoxieException(e);
    }

    String groupId = map.getString(Toolkit.Key.groupId.name(), "");
    String artifactId = map.getString(Toolkit.Key.artifactId.name(), "");
    String projectName = map.getString(Toolkit.Key.name.name(), null);
    if (StringUtils.isEmpty(projectName)) {
      projectName = groupId + ":" + artifactId;
    }

    String version;
    String releaseVersion = map.getString(Toolkit.Key.releaseVersion.name(), "");
   
    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    Date releaseDate = map.getDate(Toolkit.Key.releaseDate.name(), null);
    String releaseDateStr = releaseDate == null ? null : df.format(releaseDate);
    Date buildDate = new Date();
    String buildDateStr = buildDate == null ? null : df.format(buildDate);
   
    ArtifactVersion artifactVersion = new ArtifactVersion(
        map.getString(Constants.Key.version.name(), "0.0.0-SNAPSHOT"));
   
    Map<String, String> properties = new HashMap<String, String>();
    List<Substitute> replacements = new ArrayList<Substitute>();
    switch (stage) {
    case release:
      if (artifactVersion.isSnapshot()) {
        // update development snapshot info to release info
        releaseVersion = artifactVersion.setSnapshot(false).toString();
      } else {
        // preserve major.minor.incremental, increment build number
        releaseVersion = artifactVersion.incrementBuildNumber().toString();
      }
      title("Preparing RELEASE", releaseVersion);
      version = releaseVersion;
      releaseDate = buildDate;
      releaseDateStr = buildDateStr;
      replacements.add(new Substitute(Toolkit.Key.version.name(), releaseVersion));
      replacements.add(new Substitute(Toolkit.Key.releaseVersion.name(), releaseVersion));
      replacements.add(new Substitute(Toolkit.Key.releaseDate.name(), releaseDateStr));
      updateDescriptor(replacements);
     
      // update release log
      properties.put(Toolkit.Key.name.projectId(), projectName);
      properties.put(Toolkit.Key.version.projectId(), releaseVersion);
      properties.put(Toolkit.Key.buildDate.projectId(), releaseDateStr);
      properties.put(Toolkit.Key.releaseVersion.projectId(), releaseVersion);
      properties.put(Toolkit.Key.releaseDate.projectId(), releaseDateStr);
      updateReleaseLog(stage, releaseLog, properties);
      break;
    case snapshot:
      // start a new minor version SNAPSHOT development cycle
      if (artifactVersion.isSnapshot()) {
        throw new MoxieException("The current version {0} is already a SNAPSHOT!", artifactVersion.toString());
      }
      artifactVersion.setSnapshot(true);
      if (incrementNumber == null) {
        // increment minor version, if unspecified
        incrementNumber = NumberField.minor;
      }
      switch (incrementNumber) {
      case major:
        artifactVersion.incrementMajorVersion();
        break;
      case minor:
        artifactVersion.incrementMinorVersion();
        break;
      case incremental:
        artifactVersion.incrementIncrementalVersion();
        break;
      default:
        artifactVersion.incrementMinorVersion();
        break;
      }
     
      version = artifactVersion.toString();
      title("Preparing SNAPSHOT", version);
      replacements.add(new Substitute(Toolkit.Key.version.name(), version));
      updateDescriptor(replacements);

      // update release log
      updateReleaseLog(stage, releaseLog, properties);
      break;
    default:
      throw new MoxieException("Unknown stage \"{0}\"", stage);
    }
   
    // update Ant project properties
    getProject().setProperty(Toolkit.Key.name.projectId(), projectName);
    getProject().setProperty(Toolkit.Key.groupId.projectId(), groupId);
View Full Code Here

    if (sourceDir == null) {
      sourceDir = build.getConfig().getSiteTargetDirectory();
    }

    if (!sourceDir.exists()) {
      throw new MoxieException("Source folder does not exist!");
    }

    File dir = getRepositoryDir();
    JGitUtils.updateGhPages(dir, sourceDir, obliterate);
  }
View Full Code Here

      ClassSpec cs = new ClassSpec(getProject());
      mainclass = cs;
      jarSpecs.add(cs);
      return cs;
    }
    throw new MoxieException("Can only specify one main class");
  }
View Full Code Here

TOP

Related Classes of org.moxie.MoxieException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.