gpt4 book ai didi

java - 无法执行目标 org.codehaus.mojo :exec-maven-plugin:1. 2.1:exec (

转载 作者:行者123 更新时间:2023-12-01 09:29:28 31 4
gpt4 key购买 nike

我正在尝试学习 GitHub 上的开源项目。这里 here is the link to project我可以成功执行 mvn clean install。但问题是当我使用 -DskipTests=true 进行部署时,它会出现以下错误。那么我如何在本地设置此类项目,请帮助如何成功部署它,错误如下 --->

------------------------------------------------------------------------
Building Spring Blog 1.0-SNAPSHOT
------------------------------------------------------------------------

--- exec-maven-plugin:1.2.1:exec (default-cli) @ spring-blog ---



`......`
`............``
``............`
`............`
`............`
`:++:.` `...........`
:++oooo+:.` `......--.
:+++ooooooo+:.` .----.
:+++++ooooooooo+:.` `----.
:++++.`-:+ooooooooo+:.` `----.
:++++. `-:+ooooooooo+ `----.
:++++. `-:+oooooo` `----.
:++++. `-:+oo` `----.
:++++. --` `- `----.
:++++. +oo+:. `----.
:++++. +oooo: `----.
:++++. .:/+o: `----.
:++++. `.. `----.
:++++-` `.:---.
:+//////:.` `.-:::::::.
`-//////////:-` `.-::::::::::-`
`.-//////////:-` `.-::::::::::-.`
`.-//////////:-.` `.-::::::::::-.`
`.-://///////::::::::::-.`
`.-///////:::::-.`
`.-:/::-.`



2016-09-19 10:07:11.150 INFO 8368 --- [ restartedMain] me.woemler.springblog.Application : Starting Application on yogesh-GL552VW with PID 8368 (/media/yogesh/68BFB7DA4E8F9CBB/TEMP/spring-blog-master/target/classes started by yogesh in /media/yogesh/68BFB7DA4E8F9CBB/TEMP/spring-blog-master)
2016-09-19 10:07:11.153 INFO 8368 --- [ restartedMain] me.woemler.springblog.Application : No active profile set, falling back to default profiles: default
2016-09-19 10:07:11.202 INFO 8368 --- [ restartedMain] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@4d1cba86: startup date [Mon Sep 19 10:07:11 IST 2016]; root of context hierarchy
2016-09-19 10:07:11.619 WARN 8368 --- [ restartedMain] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [me.woemler.springblog.Application]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.boot.context.web.SpringBootServletInitializer
2016-09-19 10:07:11.625 ERROR 8368 --- [ restartedMain] o.s.boot.SpringApplication : Application startup failed

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [me.woemler.springblog.Application]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.boot.context.web.SpringBootServletInitializer
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:181) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:321) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:243) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:98) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:678) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:520) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:764) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]
at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:357) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:305) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1124) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1113) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]
at me.woemler.springblog.Application.main(Application.java:21) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_73]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_73]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_73]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_73]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-1.3.1.RELEASE.jar:1.3.1.RELEASE]
Caused by: java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.boot.context.web.SpringBootServletInitializer
at org.springframework.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.java:163) ~[spring-core-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:291) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:231) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:198) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:167) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
... 17 common frames omitted
Caused by: java.lang.NoClassDefFoundError: javax/servlet/ServletContext
at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_73]
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[na:1.8.0_73]
at java.lang.Class.getDeclaredMethods(Class.java:1975) ~[na:1.8.0_73]
at org.springframework.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.java:152) ~[spring-core-4.2.4.RELEASE.jar:4.2.4.RELEASE]
... 21 common frames omitted
Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletContext
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_73]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_73]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_73]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_73]
... 25 common frames omitted

2016-09-19 10:07:11.627 INFO 8368 --- [ restartedMain] .b.l.ClasspathLoggingApplicationListener : Application failed to start with classpath: [file:/media/yogesh/68BFB7DA4E8F9CBB/TEMP/spring-blog-master/target/classes/]
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 1.844s
Finished at: Mon Sep 19 10:07:11 IST 2016
Final Memory: 11M/212M
------------------------------------------------------------------------
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project spring-blog: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:

最佳答案

您缺少 servlet-api 依赖项,如您在

中看到的那样
Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletContext
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_73]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_73]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_73]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_73]
... 25 common frames omitted

依赖项“jSTL”对 servlet-api 有暂时依赖项,但在依赖项链中的某个位置可能存在“提供”范围,因此不会传播依赖项。

“platform-b​​on”定义了“servlet-api”,因此您只需添加到您的 pom

 <dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>

你应该可以开始了。

关于java - 无法执行目标 org.codehaus.mojo :exec-maven-plugin:1. 2.1:exec (,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39565497/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com