hibernate - 为什么 gradle 不会从 jenkins 工作中运行

标签 hibernate jenkins gradle

我正在尝试在我们的 Jenkins 服务器上设置一个构建来运行 hibernate-core 项目的一个分支。

我已经能够让 Jenkins 执行 git clone 从我的 github fork 获取本地存储库,但是当 Jenkins 尝试运行 'gradlew' 命令时它失败了。

当直接从 check out 文件夹运行此脚本时,构建按预期运行,但通过 Jenkins 启动脚本时失败。

作业配置为自由式配置,构建步骤设置为“执行 shell”步骤。

构建步骤运行以下命令。
./gradlew clean test install buildReleaseBundles uploadArchives --debug --stacktrace
似乎正在执行 gradlew 脚本,但在 gradle Download 类中出现问题。

我的构建脚本输出以下内容:

Building on master
Checkout:workspace / /data/hudson/jobs/hibernate-envers-stevemac/workspace - hudson.remoting.LocalChannel@63e4f703
Using strategy: Default
Last Built Revision: Revision 7cdb4c829f28c5b029a3d43f50a54d4c89fc9665 (origin/Branch_4.0.0.Final)
Checkout:workspace / /data/hudson/jobs/hibernate-envers-stevemac/workspace - hudson.remoting.LocalChannel@63e4f703
Fetching changes from 1 remote Git repository
Fetching upstream changes from https://stevemac007@github.com/stevemac007/hibernate-core.git
Commencing build of Revision 7cdb4c829f28c5b029a3d43f50a54d4c89fc9665 (origin/Branch_4.0.0.Final)
Checking out Revision 7cdb4c829f28c5b029a3d43f50a54d4c89fc9665 (origin/Branch_4.0.0.Final)
[workspace] $ /bin/sh -xe /tmp/tomcat6-tmp/hudson9191971611159378903.sh
+ ./gradlew clean test install buildReleaseBundles uploadArchives --debug --stacktrace
Downloading http://repo.gradle.org/gradle/distributions/gradle-1.0-milestone-3-bin.zip

Exception in thread "main" java.io.FileNotFoundException: /usr/share/tomcat6/.gradle/wrapper/dists/gradle-1.0-milestone-3-bin.zip.part (No such file or directory)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:194)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:145)
    at org.gradle.wrapper.Download.downloadInternal(Download.java:46)
    at org.gradle.wrapper.Download.download(Download.java:37)
    at org.gradle.wrapper.Install.createDist(Install.java:54)
    at org.gradle.wrapper.Wrapper.execute(Wrapper.java:80)
    at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:37)
Build step 'Execute shell' marked build as failure
Finished: FAILURE

最佳答案

与此类问题一样,实际询问它使我正确地重新阅读消息并寻找结果。

在这种情况下,我需要的所有信息都在那里。
FileNotFoundException: /usr/share/tomcat6/.gradle/wrapper/dists/gradle-1.0-milestone-3-bin.zip.part (No such file or directory)
问题是运行 Jenkins 作业的用户与我在服务器上运行该作业的用户不同,并且该作业没有对/usr/share/tomcat6/文件夹的写访问权限。

授予 tomcat6 用户对/usr/share/tomcat6 的写访问权限允许此作业运行。

关于hibernate - 为什么 gradle 不会从 jenkins 工作中运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8719765/

相关文章:

hibernate - 如何在 hibernate 过滤条件中使用子选择 HQL?

java - Spring boot - Jpa - SaveAll(Entity <S>) 数据库中缺少实体

python - 如何告诉 Jenkins 使用特定的 virtualenv python

shell - Gradle Exec任务无法运行sed

java - Gradle Eclipse 使用不正确的依赖版本

java - Gradle Jar - 包括依赖项的类

java - Autowiring 依赖项的Spring BeanCreationException注入(inject)失败

jenkins - 在 ubuntu 14.1 上安装的 Jenkins 上运行 TestNG 测试用例时出现 "java.lang.IllegalStateException: The driver is not executable"错误

maven - 在 Jenkins Maven 作业中显示自定义测试结果

java - 在 hibernate 中覆盖CreationTimestamp/UpdateTimestamp?