无法在Linux上以非管理员用户身份使用Gradle。

huangapple go评论58阅读模式
英文:

Can not use gradle as non-admin users in linux

问题

例如命令"gradle tasks --info"返回失败,显示行为"无法为/opt/gradle/gradle-7.4/bin/daemon/7.4/registry.bin.lock创建锁文件"。相同命令在超级用户下正常工作。我已尝试为/opt/gradle/gradle-7.4/bin/daemon授予所有用户权限,但他们只能运行gradle命令一次。然后权限再次变为drwx------。

英文:

For example command "gradle tasks --info" returns FAILURE with line Couldn't create lock file for /opt/gradle/gradle-7.4/bin/daemon/7.4/registry.bin.lock
Same command as superuser works fine.
I've tried to give all users permissions for /opt/gradle/gradle-7.4/bin/daemon, but they can only run gradle command once. Then permissions become drwx------ again

答案1

得分: 0

每个用户应该有自己的个人文件夹,用于保存守护进程、缓存等内容。似乎系统中的某些东西设置了一个不是默认值的 GRADLE_USER_HOME 值:

https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_properties_and_system_properties

GRADLE_USER_HOME

指定Gradle用户主目录(如果未设置,默认为当前用户的主目录/.gradle)。

您可以尝试找到设置此不正确值的地方,或者全局设置 GRADLE_USER_HOME 的值为所有用户的 $HOME/.gradle

英文:

Each user should have their own personal folder that holds the daemons/cache/etc. It would appear that something on that system is setting a value to GRADLE_USER_HOME that is not the default:

https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_properties_and_system_properties

> GRADLE_USER_HOME
>
> Specifies the Gradle user home directory (which
> defaults to <home directory of the current user>/.gradle if not set).

You could possibly either find the place that is setting the incorrect value for this, or you can globally set the value of GRADLE_USER_HOME for all users to $HOME/.gradle.

huangapple
  • 本文由 发表于 2023年6月29日 12:08:40
  • 转载请务必保留本文链接:https://go.coder-hub.com/76578006.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定