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

Windows: Metafix-Runner sometimes complains that file path of runner is too long #371

Closed
TobiasNx opened this issue Oct 8, 2024 · 7 comments · Fixed by #382
Closed

Windows: Metafix-Runner sometimes complains that file path of runner is too long #371

TobiasNx opened this issue Oct 8, 2024 · 7 comments · Fixed by #382
Assignees

Comments

@TobiasNx
Copy link
Collaborator

TobiasNx commented Oct 8, 2024

We have not found a solution yet.

$ C:\Users\USER\Downloads\metafix-runner-1.1.2\metafix-runner-1.1.2\bin\metafix-runner.bat
Die eingegebene Zeile ist zu lang.
Syntaxfehler.

Same for:

$ C:\Users\USER\Downloads\metafix-runner-1.1.2\metafix-runner\bin\metafix-runner.bat
$ C:\Users\USER\Downloads\metafix-runner\metafix-runner\bin\metafix-runner.bat
$ C:\Users\USER\Downloads\metafix-runner\metafix-runner-1.1.2\bin\metafix-runner.bat
$ C:\Users\USER\Downloads\metafix-runner-1.1.2\bin\metafix-runner.bat

The following works:

$ C:\Users\USER\Downloads\metafix-runner\bin\metafix-runner.bat
$ C:\Users\USER\Desktop\metafix-runner\bin\metafix-runner.bat

Workaround is to extract the metafix-runner without version in the download folder, the desktop or in the homefolder (maybe then with version would work too)

@TobiasNx TobiasNx changed the title Runner on windows sometimes complains that path is too long Runner on windows sometimes complains that file path of runner is too long Oct 8, 2024
@dr0i dr0i moved this to Ready in Metafacture Oct 14, 2024
@dr0i dr0i moved this from Ready to Selected in Metafacture Oct 14, 2024
@dr0i dr0i moved this from Selected to Backlog in Metafacture Oct 14, 2024
@TobiasNx
Copy link
Collaborator Author

Installed version of Metafacture Core works:

PS C:\Users\USER\git\metafacture-core> c:\Users\USER\git\metafacture-core\metafacture-runner\build\install\metafacture-core\flux.bat c:\Users\USER\Downloads\playground.flux

Release distribution seems to work too:

PS C:\Users\User\Downloads\metafacture-core-6.1.2-dist\metafacture-core-6.1.2-dist> C:\Users\User\Downloads\metafacture-core-6.1.2-dist\metafacture-core-6.1.2-dist\flux.bat

@TobiasNx
Copy link
Collaborator Author

TobiasNx commented Oct 17, 2024

From Fix repo:

./gradlew :metafix-runner:run --args="c:\Users\buelte\Downloads\playground.flux"
...
BUILD SUCCESSFUL in 1s
6 actionable tasks: 1 executed, 5 up-to-date

but:

./gradlew.bat :metafix-runner:run 

and

./gradlew :metafix-runner:run 

Have some kind of error, at first the seem to work and output the flux commands. But the build results in an error:

PS C:\Users\User\git\metafacture-fix> ./gradlew :metafix-runner:run                                                           

> Task :metafix-runner:run FAILED
Welcome to Metafacture
======================

{builtby=pc, version=6.1.2, timestamp=1721034436348}
...
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':metafix-runner:run'.
> Process 'command 'C:\Users\buelte\.gradle\jdks\eclipse_adoptium-11-amd64-windows.2\bin\java.exe'' finished with non-zero exit value 2

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.10.2/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 1s
6 actionable tasks: 1 executed, 5 up-to-date

@blackwinter
Copy link
Member

Have some kind of error, at first the seem to work and output the flux commands. But the build results in an error:

So do the batch scripts. Flux exits with an error code when no file is given.

@TobiasNx TobiasNx changed the title Runner on windows sometimes complains that file path of runner is too long Windows: Metafix-Runner sometimes complains that file path of runner is too long Oct 17, 2024
@blackwinter
Copy link
Member

The difference between Metafix and Core is that the latter provides a bespoke batch script, while the former generates a generic one via Gradle's Application plugin. This error may theoretically hit both in the same way, but the Metafix script already contains a pretty long CLASSPATH variable which includes the path to the application directory (APP_HOME) a bunch of times, thus easily exceeding the command-line string limitation.

In addition to that, the Metafix runner doesn't support the same configuration options as the Core runner (namely, java-options.conf).

Both differences may hopefully become moot once Metafix gets integrated into Core.

@maipet
Copy link
Collaborator

maipet commented Oct 23, 2024

Tested with the metafix-runner.bat in Windows: set the classpath with wildcard set CLASSPATH=%APP_HOME%\lib\* (Flux ran without the error message). But I don't know whether this could cause problems elsewhere
(cf. https://stackoverflow.com/questions/1503708/problem-running-bat-file-on-windows-due-to-input-line-is-too-long resp. https://docs.oracle.com/javase/6/docs/technotes/tools/windows/classpath.html)

dr0i added a commit that referenced this issue Oct 29, 2024
The generated start script for Windows consists of a huge classpath.
This classpath was too long, resulting in an error when executing the start
script. Using wildcard to include libraries shortens the classpath so that now
error occurs when executing the start script.
@dr0i
Copy link
Member

dr0i commented Oct 29, 2024

@maipet right, if you manipulate metafix-runner.bat that change would be overwritten next time someone invokes gradle's application plugin, e.g. by running ./gradlew distZip. in ffa5b7a I followed https://stackoverflow.com/questions/32088966/gradle-generated-startscript-for-windows-produces-input-line-is-too-long for a solution.

@dr0i
Copy link
Member

dr0i commented Nov 8, 2024

Also here - a big thx to all who have contributed here to fix this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants