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