Ejemplo n.º 1
0
  private MavenRepositorySystemSession setupRepoSession(RepositorySystem repoSystem) {
    MavenRepositorySystemSession session = new MavenRepositorySystemSession();

    LocalRepository localRepo =
        new LocalRepository(OSUtils.getUserHomeDir().getAbsolutePath() + "/.m2/repository");
    session.setLocalRepositoryManager(repoSystem.newLocalRepositoryManager(localRepo));
    session.setOffline(false);

    session.setTransferErrorCachingEnabled(false);
    session.setNotFoundCachingEnabled(false);
    return session;
  }
Ejemplo n.º 2
0
 @DefaultCommand
 public void run(
     @Option(description = "The files to edit", defaultValue = ".") final Resource<?>[] dirs)
     throws IOException {
   for (Resource<?> resource : dirs) {
     if (resource instanceof FileResource<?>) {
       Desktop dt = Desktop.getDesktop();
       try {
         dt.edit((File) resource.getUnderlyingResourceObject());
       } catch (UnsupportedOperationException e) {
         if (OSUtils.isLinux()) {
           NativeSystemCall.exec(true, "gedit", resource.getFullyQualifiedName());
         } else throw e;
       }
     }
   }
 }