vbrandl opened a new issue, #7442: URL: https://github.com/apache/netbeans/issues/7442
### Apache NetBeans version Apache NetBeans 22 ### What happened NetBeans seems to replace Gradle CLI Parameters with their short form based on [GradleCommandLine](https://github.com/apache/netbeans/blob/master/extide/gradle/src/org/netbeans/modules/gradle/api/execute/GradleCommandLine.java#L146). When defining a custom build task with the `--refresh-dependency` flag, this is shortened to `-U`. The addition of the `-U` flag came with commit 9bc649bac0bdd83d51a71cce80759252dd213b00. This flag is not supported in Gradle versions below 8: * [Gradle 7.6.2 Userguide](https://docs.gradle.org/7.6.2/userguide/command_line_interface.html) (note that `-U` is missing from the `--refresh-dependencies` documentation * [Gradle 8.5 Userguide](https://docs.gradle.org/8.5/userguide/command_line_interface.html) (here `-U` is documented) This behavior breaks all custom Gradle tasks using the `--refresh-dependencies` flag in projects that use a Gradle wrapper < 8. ### Language / Project Type / NetBeans Component Java Gradle Project ### How to reproduce * Create a Gradle Project with a Gradle 7 wrapper (`gradle init`, then `./gradlew wrapper --gradle-version 7.6.2`). Now `./gradlew -U` should fail with `Unknown command-line option '-U'.` * Add a custom task under `Project Properties` -> `Build` -> `Build Actions`, with the arguments `--refresh-dependencies check` * Execute the new task * The Output shows something like this: ``` JAVA_HOME="/usr/lib/jvm/default" cd <path to project>; ./gradlew --configure-on-demand -U check ``` Here `--refresh-dependencies` has been replaced with `-U` which is not supported by the Gradle wrapper. * The output stays empty and an unexpected exception is reported: ``` A org.gradle.tooling.exceptions.UnsupportedBuildArgumentException has occurred. If you are running the [latest](https://netbeans.apache.org/download) version of NetBeans you can [report this](https://netbeans.apache.org/nb/report-issue), including a copy of your messages.log file as an attachment. The messages.log file is located in [this folder](file:///home/me/.netbeans/22/var/log/). ``` Here is the `messages.log` file: [messages.log](https://github.com/user-attachments/files/15613174/messages.log) ### Did this work correctly in an earlier version? Apache NetBeans 21 ### Operating System Linux ### JDK openjdk 17.0.11 2024-04-16 ### Apache NetBeans packaging Third-party package ### Anything else This should have worked even on NetBeans 22 before the commit 9bc649bac0bdd83d51a71cce80759252dd213b00. This might also affect other Gradle flags, I only noticed it for `--refresh-dependencies` until now. I would suggest not replacing user supplied arguments or to keep track of the minimum required Gradle version for each flag and only replace flags that are actually supported ### Are you willing to submit a pull request? No -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
