onlyGuo / nginx-gui

Nginx GUI Manager

Home Page:http://blog.321aiyi.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

编译jar包的时候会报错

WWarrenFly opened this issue · comments

使用maven编译的时候会报错误,Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...)
我jdk用的1.8,maven用的3.6,有朋友遇到过这样的问题么,求解答

使用mvn clean package编译时报错

我jdk用的1.8,maven用的3.6,有朋友遇到过这样的问题么,求解答

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.11 sec <<< FAI
LURE! - in com.xhd.aiyi.wiki.wiki.WikiApplicationTests
initializationError(com.xhd.aiyi.wiki.wiki.WikiApplicationTests) Time elapsed:
0.003 sec <<< ERROR!
java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you
need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test

    at org.springframework.util.Assert.state(Assert.java:70)
    at org.springframework.boot.test.context.SpringBootTestContextBootstrapp

er.getOrFindConfigurationClasses(SpringBootTestContextBootstrapper.java:202)
at org.springframework.boot.test.context.SpringBootTestContextBootstrapp
er.processMergedContextConfiguration(SpringBootTestContextBootstrapper.java:137)

    at org.springframework.test.context.support.AbstractTestContextBootstrap

per.buildMergedContextConfiguration(AbstractTestContextBootstrapper.java:409)
at org.springframework.test.context.support.AbstractTestContextBootstrap
per.buildDefaultMergedContextConfiguration(AbstractTestContextBootstrapper.java:
323)
at org.springframework.test.context.support.AbstractTestContextBootstrap
per.buildMergedContextConfiguration(AbstractTestContextBootstrapper.java:277)
at org.springframework.test.context.support.AbstractTestContextBootstrap
per.buildTestContext(AbstractTestContextBootstrapper.java:112)
at org.springframework.boot.test.context.SpringBootTestContextBootstrapp
er.buildTestContext(SpringBootTestContextBootstrapper.java:82)
at org.springframework.test.context.TestContextManager.(TestContex
tManager.java:120)
at org.springframework.test.context.TestContextManager.(TestContex
tManager.java:105)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.creat
eTestContextManager(SpringJUnit4ClassRunner.java:152)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.<init

(SpringJUnit4ClassRunner.java:143)
at org.springframework.test.context.junit4.SpringRunner.(SpringRun
ner.java:49)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct

orAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBui
lder.java:104)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(Annotated
Builder.java:86)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilde
r.java:59)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForC
lass(AllDefaultPossibilitiesBuilder.java:26)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilde
r.java:59)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:
33)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provide
r.java:283)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUni
t4Provider.java:173)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4
Provider.java:153)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider
.java:128)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameCla
ssLoader(ForkedBooter.java:203)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(Fork
edBooter.java:155)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:
103)

Results :

Tests in error:
WikiApplicationTests.initializationError ? IllegalState Unable to find a @SPRI
...

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.696 s
[INFO] Finished at: 2019-02-15T11:53:05+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.
18.1:test (default-test) on project nginx: There are test failures.
[ERROR]
[ERROR] Please refer to D:\nginx-gui-master\target\surefire-reports for the indi
vidual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc
eption

是我大意了, 感谢@climba03003