我正在尝试教程" http://spring.io/guides/tutorials/web/"我收到错误:
无法读取类文件xxx/tut-web/initial/build/classes/test/com/yummynoodlebar/web/controller/fixture/WebDataFixture.class
在尝试sudo时./gradlew clean test.
更深入的细节:
sudo ./gradlew clean test --info
Starting Build
Settings evaluated using settings file '/home/demecarv/Desenv/Samples/Sample_git/tut-web/initial/settings.gradle'.
Projects loaded. Root project using build file '/home/demecarv/Desenv/Samples/Sample_git/tut-web/initial/build.gradle'.
Included projects: [root project 'tut-web-initial']
Evaluating root project 'tut-web-initial' using build file '/home/demecarv/Desenv/Samples/Sample_git/tut-web/initial/build.gradle'.
All projects evaluated.
Selected primary tasks 'clean', 'test'
Tasks to be executed: [task ':clean', task ':compileJava', task ':processResources', task ':classes', task ':compileTestJava', task ':processTestResources', task ':testClasses', task ':test']
:clean
Task ':clean' has not declared any outputs, assuming that it is out-of-date.
:compileJava
Executing task ':compileJava' due to:
Output file /home/demecarv/Desenv/Samples/Sample_git/tut-web/initial/build/classes/main has changed.
Output file /home/demecarv/Desenv/Samples/Sample_git/tut-web/initial/build/dependency-cache has changed.
Output file /home/demecarv/Desenv/Samples/Sample_git/tut-web/initial/build/classes/main/com/yummynoodlebar/events/orders/SetOrderPaymentEvent.class has been removed.
Output file /home/demecarv/Desenv/Samples/Sample_git/tut-web/initial/build/classes/main/com/yummynoodlebar/events/orders/OrderStatusEvent.class has been removed.
Output file /home/demecarv/Desenv/Samples/Sample_git/tut-web/initial/build/classes/main/com/yummynoodlebar/events/menu/RequestMenuItemDetailsEvent.class has been removed.
Output file /home/demecarv/Desenv/Samples/Sample_git/tut-web/initial/build/classes/main/com/yummynoodlebar/core/domain/Ingredient.class has been removed.
Output file /home/demecarv/Desenv/Samples/Sample_git/tut-web/initial/build/classes/main/com/yummynoodlebar/events/orders/OrderDetails.class has been removed.
Output file /home/demecarv/Desenv/Samples/Sample_git/tut-web/initial/build/classes/main/com/yummynoodlebar/events/DeletedEvent.class has been removed.
Output file /home/demecarv/Desenv/Samples/Sample_git/tut-web/initial/build/classes/main/com/yummynoodlebar/persistence/repository/OrdersRepository.class has been removed.
Output file /home/demecarv/Desenv/Samples/Sample_git/tut-web/initial/build/classes/main/com/yummynoodlebar/events/menu/RequestAllMenuItemsEvent.class has been removed.
Compiling with JDK Java compiler API.
:processResources
Executing task ':processResources' due to:
Output file /home/demecarv/Desenv/Samples/Sample_git/tut-web/initial/build/resources/main has changed.
Output file /home/demecarv/Desenv/Samples/Sample_git/tut-web/initial/build/resources/main/log4j.properties has been removed.
:classes
Skipping task ':classes' as it has no actions.
:compileTestJava
:: loading settings :: url = jar:file:/root/.gradle/wrapper/dists/gradle-1.6-bin/72srdo3a5eb3bic159kar72vok/gradle-1.6/lib/ivy-2.2.0.jar!/org/apache/ivy/core/settings/ivysettings.xml
Executing task ':compileTestJava' due to:
Output file /home/demecarv/Desenv/Samples/Sample_git/tut-web/initial/build/dependency-cache has changed.
Output file /home/demecarv/Desenv/Samples/Sample_git/tut-web/initial/build/classes/test has changed.
Output file /home/demecarv/Desenv/Samples/Sample_git/tut-web/initial/build/classes/test/com/yummynoodlebar/core/domain/fixtures/OrdersFixtures.class has been removed.
Output file /home/demecarv/Desenv/Samples/Sample_git/tut-web/initial/build/classes/test/com/yummynoodlebar/web/controller/fixture/WebDataFixture.class has been removed.
Compiling with JDK Java compiler API.
:processTestResources
Skipping task ':processTestResources' as it has no source files.
:processTestResources UP-TO-DATE
:testClasses
Skipping task ':testClasses' as it has no actions.
:test
Executing task ':test' due to:
No history is available.
:test FAILED
答案 0 :(得分:2)
尝试将JAVA_HOME设置为JAVA 6 SDK。
我在使用JAVA 8的本教程中遇到了同样的错误。我安装了Java 6 SDK并将JAVA_HOME指向Java 6 JDK目录,并且构建成功完成。