Fixed start-from and missing stack trace on excetpion

This commit is contained in:
Marcin Grzejszczak
2018-06-25 17:27:43 +02:00
parent fe00a36f5b
commit 5ee4f171b4
2 changed files with 13 additions and 2 deletions

View File

@@ -15,6 +15,8 @@
*/
package org.springframework.cloud.release.internal;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
@@ -27,6 +29,8 @@ import org.springframework.cloud.release.internal.spring.SpringReleaser;
@SpringBootApplication
public class ReleaserApplication implements CommandLineRunner {
private static final Logger log = LoggerFactory.getLogger(ReleaserApplication.class);
public static void main(String[] args) {
SpringApplication application = new SpringApplication(ReleaserApplication.class);
application.setWebApplicationType(WebApplicationType.NONE);
@@ -38,7 +42,11 @@ public class ReleaserApplication implements CommandLineRunner {
@Override public void run(String... strings) throws Exception {
Options options = this.parser.parse(strings);
this.releaser.release(options);
try {
this.releaser.release(options);
} catch (Exception e) {
log.error("Exception occurred for the releaser", e);
}
System.exit(0);
}
}

View File

@@ -121,7 +121,10 @@ public class SpringReleaser {
if (StringUtils.hasText(options.startFrom)) {
int projectIndex = filteredProjects.indexOf(options.startFrom);
if (projectIndex < 0) throw new IllegalStateException("Project [" + options.startFrom + "] not found");
filteredProjects = filteredProjects.subList(projectIndex, projects.size());
if (log.isDebugEnabled()) {
log.debug("Index of project [{}] is [{}]", options.startFrom, projectIndex);
}
filteredProjects = filteredProjects.subList(projectIndex, filteredProjects.size());
options.startFrom = "";
} else if (!options.taskNames.isEmpty()) {
filteredProjects = filteredProjects.stream()