我在运行 Travis Ci 时遇到问题。我的 Spring Boot 应用程序出现以下错误。0.01s$ java -Xmx32m -versionopenjdk version "11.0.2" 2019-01-15OpenJDK Runtime Environment 18.9 (build 11.0.2+9)OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)$ javac -J-Xmx32m -versionjavac 11.0.23.37s$ ./gradlew assembleError: Could not find or load main class org.gradle.wrapper.GradleWrapperMainCaused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMainThe command "eval ./gradlew assemble " failed. Retrying, 2 of 3.Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMainCaused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMainThe command "eval ./gradlew assemble " failed. Retrying, 3 of 3.Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMainCaused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMainThe command "eval ./gradlew assemble " failed 3 times.The command "./gradlew assemble" failed and exited with 1 during .Your build has been stopped..travis.yml文件language: javasudo: falsescript: mvn clean verify让我知道您需要哪些文件。
2 回答
一只甜甜圈
TA贡献1836条经验 获得超5个赞
看起来您忘记签入 gradle/wrapper 中的文件。它应该有两个文件gradle-wrapper.jar
和gradle-wrapper.properties
.
拉风的咖菲猫
TA贡献1995条经验 获得超2个赞
好吧,问题是我的 Spring-boot 应用程序同时具有 Maven 和 Gradle 文件。我相信,当我尝试不同的东西时,我生成了 Gradew 文件,因此 Travis CI 正在寻找 Gradle。
解决方案是删除所有 gradle 文件并重新运行 travis。我已经更新了我的 travis.yml 如下
jdk:
- oraclejdk8
# would just use default install/script but the ./mvnw script errors on travis
# obviously this only works for maven builds right now...
install:
- mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
- mvn cobertura:cobertura
script:
- mvn test
dist: trusty
after_success:
- bash <(curl -s https://codecov.io/bash) -t
添加回答
举报
0/150
提交
取消