Achal1607 opened a new pull request, #8897:
URL: https://github.com/apache/netbeans/pull/8897

   - When a `mainClass` is defined in a source set other than `main` in a 
Gradle project, the NetBeans Gradle action was unable to run or debug that 
class. This has been fixed by introducing a new project configuration 
parameter, `runSourceSetName`, similar to `runSelectedClassName`.
   
   - Additionally, in the LSP launch configuration, specifying a `mainClass` 
from a non-`main` source set in `launch.json` previously caused it to run as if 
it were part of the test source set. This behavior has been corrected so that 
the specified `mainClass` is now executed properly instead of running tests.
   
   Before fix:
   ```
   JAVA_HOME="JDK_PATH"
   cd PATH_TO_PROJECT/GradleTestingProject/app; ../gradlew 
--configure-on-demand -PrunClassName=org.yourcompany.yourproject.Main -s -x 
check run
   Configuration on demand is an incubating feature.
   > Task :app:compileJava UP-TO-DATE
   > Task :app:processResources NO-SOURCE
   > Task :app:classes UP-TO-DATE
   
   > Task :app:run FAILED
   Error: Could not find or load main class org.yourcompany.yourproject.Main
   Caused by: java.lang.ClassNotFoundException: org.yourcompany.yourproject.Main
   
   FAILURE: Build failed with an exception.
   
   * What went wrong:
   Execution failed for task ':app:run'.
   > Process 'command 'JDK_PATH/bin/java'' finished with non-zero exit value 1
   ```
   
   
   After fix:
   ```
   JAVA_HOME="JDK_PATH"
   cd PATH_TO_PROJECT/GradleTestingProject/app; ../gradlew 
--configure-on-demand -PrunClassName=org.yourcompany.yourproject.Main 
-PrunSourceSetName=test -s -x check run
   Configuration on demand is an incubating feature.
   > Task :app:compileJava UP-TO-DATE
   > Task :app:processResources NO-SOURCE
   > Task :app:classes UP-TO-DATE
   > Task :app:compileTestJava UP-TO-DATE
   > Task :app:processTestResources NO-SOURCE
   > Task :app:testClasses UP-TO-DATE
   
   > Task :app:run
   Hello World MAIN!!
   
   BUILD SUCCESSFUL in 282ms
   3 actionable tasks: 1 executed, 2 up-to-date
   
   ```


-- 
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

Reply via email to