情况:在azure管道的构建过程中,我在自托管代理上使用JavaToolInstaller,它会放置"java/java_HOME_8_x64_;在目录中
背景:当我对该目录应用了完全权限并为构建过程创建该目录时,我不认为这是权限问题
评估:以前有人看到过这个问题吗?
复制步骤-主机现场代理
JavaToolInstaller
- task: JavaToolInstaller@0
inputs:
versionSpec: '8'
jdkArchitectureOption: 'x64'
jdkSourceOption: 'LocalDirectory'
jdkFile: '/opt/jdk-8u251-linux-x64.tar.gz'
jdkDestinationDirectory: '/opt/java'
cleanDestinationDirectory: true
condition: eq( variables['Agent.OS'], 'Linux' )
生成时出错
Cleaning destination folder before extraction: /opt/java
Retrieving the JDK from local path.
##[warning]Can't find loc string for key: ExtractingArchiveToPath
ExtractingArchiveToPath /opt/java/JAVA_HOME_8_x64_jdk-8u251-linux-x64_tar.gz
Creating destination folder: /opt/java/JAVA_HOME_8_x64_jdk-8u251-linux-x64_tar.gz
##[error]Unable to create directory '/opt/java/JAVA_HOME_8_x64_jdk-8u251-linux-x64_tar.gz'. EACCES: permission denied, mkdir '/opt/java/JAVA_HOME_8_x64_jdk-8u251-linux-x64_tar.gz'
##[error]Unable to create directory '/opt/java/JAVA_HOME_8_x64_jdk-8u251-linux-x64_tar.gz'. EACCES: permission denied, mkdir '/opt/java/JAVA_HOME_8_x64_jdk-8u251-linux-x64_tar.gz'
Finishing: JavaToolInstaller
根据错误消息,您似乎没有写入此文件的权限。请检查并确保您对此文件夹具有w和r权限
步骤:
找到文件jdk-8u251-linux-x64.tar.gz->右键单击图标->选择"属性"->单击选项卡权限,然后检查帐户权限
或者使用cmdls –l {file name}
检查文件夹权限,然后运行cmd chmod [permission] [file_name]
更新权限
请参阅此链接了解更多详细信息:如何在Linux 中更改目录权限