Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MINVOKER-335] Preserve symlinks for copied files #231

Merged
merged 1 commit into from
May 2, 2024

Conversation

slawekjaranowski
Copy link
Member

@slawekjaranowski slawekjaranowski merged commit 6a67708 into master May 2, 2024
44 checks passed
@slawekjaranowski slawekjaranowski deleted the MINVOKER-335 branch May 2, 2024 16:46
@michael-o
Copy link
Member

This IT is incomplete because the GHA Windows runners are configured not like a regular machine. It fails for me:

Running pre-build script: D:\Entwicklung\Projekte\maven-invoker-plugin\target\it\MINVOKER-335-symlinks-in-source\setup.groovy
java.nio.file.FileSystemException: D:\Entwicklung\Projekte\maven-invoker-plugin\target\it\MINVOKER-335-symlinks-in-source\src\it\clone-symlinks\testDirLink: Dem Client fehlt ein erforderliches Recht.

	at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:86)
	at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
	at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
	at sun.nio.fs.WindowsFileSystemProvider.createSymbolicLink(WindowsFileSystemProvider.java:585)
	at java.nio.file.Files.createSymbolicLink(Files.java:1043)
	at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321)
	at Script1.run(Script1.groovy:31)
	at groovy.lang.GroovyShell.evaluate(GroovyShell.java:460)
	at groovy.lang.GroovyShell.evaluate(GroovyShell.java:495)
	at groovy.lang.GroovyShell.evaluate(GroovyShell.java:469)
	at org.apache.maven.shared.scriptinterpreter.GroovyScriptInterpreter.evaluateScript(GroovyScriptInterpreter.java:69)
	at org.apache.maven.shared.scriptinterpreter.ScriptRunner.executeRun(ScriptRunner.java:223)
	at org.apache.maven.shared.scriptinterpreter.ScriptRunner.run(ScriptRunner.java:160)
	at org.apache.maven.plugins.invoker.AbstractInvokerMojo.runBuild(AbstractInvokerMojo.java:1823)
	at org.apache.maven.plugins.invoker.AbstractInvokerMojo.runBuild(AbstractInvokerMojo.java:1545)
	at org.apache.maven.plugins.invoker.AbstractInvokerMojo.lambda$runBuilds$4(AbstractInvokerMojo.java:1307)
	at org.apache.maven.plugins.invoker.JobExecutor.lambda$forEach$0(JobExecutor.java:63)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:750)
Running post-build script: D:\Entwicklung\Projekte\maven-invoker-plugin\target\it\MINVOKER-335-symlinks-in-source\verify.groovy
java.nio.file.NoSuchFileException: D:\Entwicklung\Projekte\maven-invoker-plugin\target\it\MINVOKER-335-symlinks-in-source\target\it\clone-symlinks\testDirLink
	at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)
	at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
	at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
	at sun.nio.fs.WindowsLinkSupport.readLink(WindowsLinkSupport.java:56)
	at sun.nio.fs.WindowsFileSystemProvider.readSymbolicLink(WindowsFileSystemProvider.java:628)
	at java.nio.file.Files.readSymbolicLink(Files.java:1432)
	at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321)
	at Script1.run(Script1.groovy:25)
	at groovy.lang.GroovyShell.evaluate(GroovyShell.java:460)
	at groovy.lang.GroovyShell.evaluate(GroovyShell.java:495)
	at groovy.lang.GroovyShell.evaluate(GroovyShell.java:469)
	at org.apache.maven.shared.scriptinterpreter.GroovyScriptInterpreter.evaluateScript(GroovyScriptInterpreter.java:69)
	at org.apache.maven.shared.scriptinterpreter.ScriptRunner.executeRun(ScriptRunner.java:223)
	at org.apache.maven.shared.scriptinterpreter.ScriptRunner.run(ScriptRunner.java:160)
	at org.apache.maven.plugins.invoker.AbstractInvokerMojo.runPostBuildHook(AbstractInvokerMojo.java:1905)
	at org.apache.maven.plugins.invoker.AbstractInvokerMojo.runBuild(AbstractInvokerMojo.java:1886)
	at org.apache.maven.plugins.invoker.AbstractInvokerMojo.runBuild(AbstractInvokerMojo.java:1545)
	at org.apache.maven.plugins.invoker.AbstractInvokerMojo.lambda$runBuilds$4(AbstractInvokerMojo.java:1307)
	at org.apache.maven.plugins.invoker.JobExecutor.lambda$forEach$0(JobExecutor.java:63)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:750)

You cannot create a symlink on Windows unless you have an elevated shell or developer mode. See: https://www.reddit.com/r/Batch/comments/p8m0bn/creating_smbolic_link_symlink_without_admin/

You need to create a selector script which tries to create a symlink, if it succeeds you can continue with the IT otherwise you need to skipt it.

@slawekjaranowski
Copy link
Member Author

@michael-o - done in #237

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants