Well, first of all NB17-rc1 bundles Gradle 8.0-rc-1. Unfortunately I have
no NB17-rc1 at hand, but have the latest dev build from master (which is
almost identical to the rc1 this time).

So with that build, I see runSingle action works correctly when used on a
simple NetBeans created Java Application or Library project. The injected
task is rather simple. It just creates a simple JavaExec task with the main
classpath and the java class to be executed.

If someone needs something more sophisticated, it is always possible to
create a runSingle task in the project. in that case NetBeans would use
that task.

Of course we can improve as well, though it would be good to have a sample
project on github or attached as a zip to have a clear base of
understanding.

The Gradle plugin in NB needs a better support for Java Toolchain. I have
plans for that, unfortunately it did not fit in the NB17 release window.

On Thu, Jan 19, 2023 at 7:26 PM Scott Palmer <swpal...@gmail.com> wrote:

> So it seems runSingle isn't working properly for a build that has
> subprojects.  I have a main project that has two subprojects and the
> runSingle task was injected into a subproject as well when I tried to run a
> file in the main project.  So the main project succeeded, and then the
> subproject was confused.
> Here is the output of running the 'Test' class in the main project:
>
> > Task :runSingle
> done
>
> > Task :Model:runSingle FAILED
> Error: Could not find or load main class example.Test
> Caused by: java.lang.ClassNotFoundException: example.Test
>
> The 'Model' project failed.  It doesn't depend on the main project, the
> dependency is the other way around, so of course the class was not found.
>
> I also just discovered that the injected runSingle task can get confused
> about the toolchain. The toolchain is set to 19 in the gradle script, but
> with Source/Binary format set to the 'default' in the NB project settings.
> If that doesn't match, things can go wrong. The result is that if NB is
> running on JDK 17, the classes are compiled for JDK 19 and NB ends up
> trying to run JDK 19 classes with JDK 17 runtime.  The
> Source/Binary settings in the project dialog shouldn't be mismatched of
> course. I wonder if NB can detect the use of the Gradle toolchain support
> and make it read-only and set to the value used for the toolchain?
>
> It looks like NB 17 is embedding and using Gradle 7.5.x for some things as
> well.  Will that be updated to 7.6 before release?
>
> Scott
>
> On Thu, Jan 19, 2023 at 7:54 PM Scott Palmer <swpal...@gmail.com> wrote:
>
> > So runSingle still fails with NB 17-rc1 and Gradle 8.0-rc-2
> >
> > > Task :Model:runSingle FAILED
> > Error: Could not find or load main class example.Test
> > Caused by: java.lang.ClassNotFoundException: example.Test
> >
> > Scott
> >
> > On Thu, Jan 19, 2023 at 11:47 AM Scott Palmer <swpal...@gmail.com>
> wrote:
> >
> >> Yes, I noticed shortly after I sent my msg.  So far NB 17-rc1 is doing
> >> much better!
> >>
> >> On Thu, Jan 19, 2023 at 9:21 AM Neil C Smith <neilcsm...@apache.org>
> >> wrote:
> >>
> >>> On Thu, 19 Jan 2023 at 14:16, Scott Palmer <swpal...@gmail.com> wrote:
> >>> > That’s NB16 with the Gradle update.  I can try to build 17 to see how
> >>> it goes there.
> >>>
> >>> 17-rc1 literally just announced.  Please try that and report issues
> >>> that might need fixing before release.
> >>>
> >>> Neil
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: dev-unsubscr...@netbeans.apache.org
> >>> For additional commands, e-mail: dev-h...@netbeans.apache.org
> >>>
> >>> For further information about the NetBeans mailing lists, visit:
> >>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
> >>>
> >>>
> >>>
> >>>
>

Reply via email to