Skip to content

GrEclipseFormatterStep fails when ~/.m2/ is not writable #1797

@DanielThomas

Description

@DanielThomas

In our CI environment, the build user cannot write to their own home directory, but we configure ~/.m2/settings.xml to change the local repository a separate mount for builds:

  <localRepository>/agent/.m2/repository</localRepository>

However the configuration of P2Model here doesn't reflect that setting, and tries to write to the read-only location:

Caused by: java.nio.file.AccessDeniedException: /home/<user>/.m2/repository	
	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:90)	
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)	
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)	
	at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:397)	
	at java.nio.file.Files.createDirectory(Files.java:700)	
	at java.nio.file.Files.createAndCheckIsDirectory(Files.java:807)	
	at java.nio.file.Files.createDirectories(Files.java:793)	
	at dev.equo.solstice.p2.FileMisc.lambda$mkdirs$2(FileMisc.java:84)	
	at dev.equo.solstice.p2.FileMisc.retry(FileMisc.java:101)	
	at dev.equo.solstice.p2.FileMisc.retry(FileMisc.java:93)	
	at dev.equo.solstice.p2.FileMisc.mkdirs(FileMisc.java:84)	
	at dev.equo.solstice.p2.QueryCacheOnDisk.<init>(QueryCacheOnDisk.java:33)	
	at dev.equo.solstice.p2.P2Model.query(P2Model.java:118)	
	at com.diffplug.spotless.extra.EquoBasedStepBuilder.get(EquoBasedStepBuilder.java:107)	
	at com.diffplug.spotless.FormatterStepImpl.calculateState(FormatterStepImpl.java:58)	
	at com.diffplug.spotless.LazyForwardingEquality.state(LazyForwardingEquality.java:56)	
	at com.diffplug.spotless.LazyForwardingEquality.unlazy(LazyForwardingEquality.java:118)	
	at com.diffplug.spotless.LazyForwardingEquality.unlazy(LazyForwardingEquality.java:124)	
	at com.diffplug.gradle.spotless.JvmLocalCache$LiveCacheKeyImpl.set(JvmLocalCache.java:60)	
	at com.diffplug.gradle.spotless.SpotlessTask.setSteps(SpotlessTask.java:168)	
	at com.diffplug.gradle.spotless.SpotlessTaskImpl_Decorated.setSteps(Unknown Source)	
	at com.diffplug.gradle.spotless.FormatExtension.setupTask(FormatExtension.java:927)	
	at com.diffplug.gradle.spotless.GroovyGradleExtension.setupTask(GroovyGradleExtension.java:56)	
	at com.diffplug.gradle.spotless.SpotlessExtensionImpl.lambda$createFormatTasks$6(SpotlessExtensionImpl.java:70)

Appears that was introduced here:

2673e91

Seen when upgrading from Spotless 6.9.1 to 6.20.0 w/ Gradle.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions