Here's where I find the GlassFish sources:
https://svn.java.net/svn/glassfish~svn
Let's set up the 4.0 branch of the above sources in NetBeans IDE. In the Team menu, use the Subversion tool to point to the above URL:
Click Next and then pick the 4.0 branch:
While the check out is taking place, add the folder where you're doing the check out to the Favorites window (Ctrl-3), which you can do by right-clicking in the Favorites window and choosing "Add to Favorites"...
...while also opening the Output window (Ctrl-4)...
Via the above two tools, you can monitor the check out as it happens. You'll see how far along things are.
When the check out is complete, right-click the root node, which is "4.0" above, in the Favorites window, and select "Open Project of Folder". The IDE opens the Maven project in the Projects window as a new NetBeans project, since the IDE knows how to interpret the Maven POM file:
Then right-click the project node and choose "Build with Dependencies".
Now another process starts up, pretty lengthy which makes sense considering how large GlassFish is, which can again be monitored in the Output window:
Note: The list of Maven projects comprising the GlassFish sources goes on quite a bit further beyond what's shown in the screenshot above.