Spring启动应用:无法启动运行

时间:2016-01-05 10:34:16

标签: spring spring-mvc gradle spring-boot build.gradle

我正在尝试使用Mac中的Gradle创建一个简单的Spring Boot应用程序。在gradle bootRun上,我收到以下错误:

失败:构建因异常而失败。

出了什么问题:任务执行失败':bootRun'。

处理'命令: ' /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/bin/java''完成非零退出值1

  • 异常是:org.gradle.api.tasks.TaskExecutionException:任务':bootRun'执行失败。在org.gradle上的org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)位于org.gradle.api.internal的org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)上的.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)位于org.gradle.api.internal.tasks.execution的org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52).tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58) .skipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecu org.gradle.execution.taskgraph.DefaultTaskGraphExecuter上的ter.execute(ExecuteAtMostOnceTaskExecuter.java:43)org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker.exe(EventTaskTraphExecuter.java) 185)org.gradle.execution.taskgraph.Abs​​tractTaskPlanExecutor $ TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)org.gradle.execution.taskgraph.Abs​​tractTaskPlanExecutor $ TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)at org.gradle.execution .taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25)org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)at at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)at org.gradle.execution.DefaultBuildExecuter.access $ 000(DefaultBuildExecuter.jav) a:23)org.gradle.execution.DefaultBuildExecuter $ 1.proceed(DefaultBuildExecuter.java:43)org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)at org.gradle.execution.DefaultBuildExecuter.execute( DefaultBuildExecuter.java:37)org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)org.gradle.initialization.DefaultGradleLauncher $ 4.run(DefaultGradleLauncher.java:154)atg.gradle.internal.Factories $ 1 。或者org.gradle.internal.progress.DefaultOperationExecutor.run(DefaultBuildOperationExecutor.java:52)org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)中的.create(Factories.java:22)。 gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:151)org.gradle.initialization.DefaultGradleLauncher.access $ 200(DefaultGradleLauncher.java:32)at org.gradle.initialization.DefaultGradleLauncher $ 1.create(DefaultGradleLauncher.java:99)在组织。 gradle.initialization.DefaultGradleLauncher $ 1.create(DefaultGradleLauncher.java:93)org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java) :62)org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93)atg.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82)org.gradle.launcher.exec.InProcessBuildActionExecuter $ DefaultBuildController。运行(InProcessBuildActionExecuter.java:94)org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)at org .gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)at org .gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:48)org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter) .java:51)atg.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:28)org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43)org.gradle.internal。动作$ RunnableActionAdapter.execute(Actions.java:170)org.gradle.launcher.cli.CommandLineActionFactory $ ParseAndBuildAction.execute(CommandLineActionFactory.java:237)at org.gradle.launcher.cli.CommandLineActionFactory $ ParseAndBuildAction.execute(CommandLineActionFactory。 java:210)org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute( JavaRuntimeValidationAction.java:24)org.gradle.launcher.cli.CommandLineActionFactory $ WithLog.exedle.launcher.cli.CommandLineActionFactory $ WithLogging.exe(CommandLineActionFactory.java:166 org.gradle.launcher.Main.doAction(Main.java)上的org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)中的.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33) :33)org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)atg.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)at org.gradle.launcher.bootstrap。 ProcessBootstrap.run(ProcessBootstrap.java:35)at org.gradle.launcher.GradleMain.main(GradleMain.java:23)引起:org.gradle.process.internal.ExecException:进程'命令' /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/bin/java''在org.gradle.process.internal.DefaultExecHandle $ ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:367)的org.gradle.process.internal.DefaultJavaExecAction.execute(DefaultJavaExecAction.java:31)的org.grag上完成非零退出值1 .gradle.api.tasks.JavaExec.exec(JavaExec.java:75)位于org.gradle.internal.refut.JavaMethod.invoke的org.springframework.boot.gradle.run.BootRunTask.exec(BootRunTask.java:62) (JavaMethod.java:75)org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory $ StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:227)at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory $ StandardTaskAction.execute (Annotation.ProcessingTaskFactory.java:220)atg.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory $ StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:209)org.gradle.api.internal.AbstractTask $ TaskActionWrapper.execute(AbstractTask.java) :585)在org.gradle.api.int在org.gradle.api.internal.tasks.execution的org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)的ernal.AbstractTask $ TaskActionWrapper.execute(AbstractTask.java:568)。 ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)... 57更多

build.gradle看起来像这样:

buildscript {
ext {
    springBootVersion = '1.3.0.M2'
}
repositories {
    mavenCentral()
    maven { url "https://repo.spring.io/snapshot" }
    maven { url "https://repo.spring.io/milestone" }
}
dependencies {
    classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 
} 
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot' 

jar {
     baseName = 'labSecurity'
     version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}


dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
testCompile("org.springframework.boot:spring-boot-starter-test")
// JPA
compile("org.springframework.boot:spring-boot-starter-data-jpa")
runtime("mysql:mysql-connector-java")
// JSP
compile("org.apache.tomcat.embed:tomcat-embed-jasper:8.0.23")
compile("javax.servlet:jstl:1.2")
// Security
compile("org.springframework.boot:spring-boot-starter-security")
testCompile("org.springframework.security:spring-security-test:4.0.1.RELEASE")
// cucumber
testCompile("info.cukes:cucumber-spring:1.2.3")
testCompile("info.cukes:cucumber-java:1.2.3")
testCompile("info.cukes:cucumber-junit:1.2.3")
testCompile("junit:junit:4.11")
}

eclipse {
classpath {
     containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
     containers  'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8'
}
}

task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}


// CUCUMBER
configurations {
cucumberRuntime {
    extendsFrom testRuntime
}
}

task cucumber() {
dependsOn assemble, compileTestJava
doLast {
    javaexec {
        main = "cucumber.api.cli.Main"
        classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
        args = ['--plugin', 'pretty', '--glue', 'labSecurity', 'src/test/resources']
    }
 }
 }

0 个答案:

没有答案