Skip to content

New project type for "generic" projects - #9736

Open
mbien wants to merge 23 commits into
apache:masterfrom
mbien:generic-project
Open

mbien wants to merge 23 commits into
apache:masterfrom
mbien:generic-project

Conversation

@mbien

@mbien mbien commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

A new project type which can be used to work with arbitrary directories on your system. It integrates with project groups and other features like a regular project.

  • The project is identified by a marker file or alternatively by a property stored in the NB config. User can modify this setting during project creation or afterwards using the properties window (marker file becomes settings storage once something is changed)
  • PR currently contains wizard, project properties window, basic actions and file filter settings
  • open required projects action (returns one level like the maven impl)
  • potentially a building block for more features (e.g DirectoryProjectProvider with GenericProject impl and DirectoryGroup replacement #9737)
  • rust modules were used as reference since they were well written and documented (thanks @vieiro !)
  • the repo was seeded with .nbgp markers for testing purposes

targets NB 33 but there is no hurry (other PRs like mvn 3.10 and jdk28 support have priority for the next release)

todo:

  • implement/verify config import for un-shared mode
  • ctrl+shift 1 does not select the file in Projects

Assisted-by: qwen3.8-27b + granite4.2:8b

screenshots

wizard
image

context menu
generic-context-menu

all clusters opened as generic project without the IDE exploding
image

image image

@mbien mbien added this to the NB33 milestone Oct 21, 2026
@mbien mbien added Editor ci:all-tests [ci] enable all tests ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) labels Oct 21, 2026
@matthiasblaesing

Copy link
Copy Markdown
Contributor

Something is broken here. There files with name .nbgp added all over the place. From a quick glance that file acts as marker and it should not be necessary to mark projects again as projects. For the naming, there is alreay .nbproject as a directory, just a thought though.

@mbien

mbien commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

From a quick glance that file acts as marker and it should not be necessary to mark projects again as projects

those paths are no projects atm + the first commit was mostly meant for testing purposes (got inspired by #9624).

@neilcsmith-net

Copy link
Copy Markdown
Member

Thanks for starting the initiative on this. It's definitely going in the right direction in my opinion. Need more time to review properly, but few initial comments.

  • As you know, I wanted to use the default AuxiliaryConfiguration attributes or file (.netbeans.xml) as marker. One reason was to not have two files in the case of configuration and sharing. I don't have concern with using a different marker, but I think any shared marker file should also contain any configuration. This would require a bespoke implementation of the configuration, or maybe just an AuxiliaryProperties implementation. This might mean the shared project marker should be something like nbproject.properties instead.
  • Settings like Display Name should be shared if the marker is shared. There should be a mechanism to migrate settings between file and attributes when converted.
  • The marker filename should also be brandable. Other platform applications using project support may want their own markers rather than creating NB branded ones, and it would stop applications picking up each others' projects.
  • I have some concerns about having any implementation of Delete. On the other hand, we almost certainly want the functionality to Forget.
  • The need to add more exceptions to FoDLayersProvider is a little concerning - not sure if there's a better way to mark these things though?

@mbien mbien removed the ci:all-tests [ci] enable all tests label Oct 26, 2026
@mbien

mbien commented Oct 26, 2026

Copy link
Copy Markdown
Member Author

points 1-3 implemented:

as mentioned back when we chatted about this. I agreed in principle but said that this is tricky due to chicken-egg problems (e.g you can't store aux config for a project without a project). But I think I found a solution. Config impl is properties based, initial marker is an empty file which happens to be a valid properties file -> marker becomes dual purpose as config too.

I have some concerns about having any implementation of Delete (...) Forget

this actually uses the default impl. Dialog has a check box with "also delete project files" which is unchecked by default. So forget is default.

The need to add more exceptions to FoDLayersProvider is a little concerning - not sure if there's a better way to mark these things though?

i did some archeology to find the bugzilla numbers (put them in the code comments). It didn't seem to be a big concern back then. What would be good would be a test which actually fails in a way which makes sense for the dev. Failures for this were completely obscure and it was difficult to figure out why the checks were there in the first place. I don't have the full picture of this so I can't do much unfortunately.

added new-project context menu action but i just noticed that it doesn't infer the relative location of the selected node for the project wizard. So we might want to remove it again - kept it to play around with it.

will add screenshots

@neilcsmith-net

Copy link
Copy Markdown
Member

points 1-3 implemented:

Thanks! Will take a deeper dive as soon as I can.

as mentioned back when we chatted about this. I agreed in principle but said that this is tricky due to chicken-egg problems (e.g you can't store aux config for a project without a project). But I think I found a solution. Config impl is properties based, initial marker is an empty file which happens to be a valid properties file -> marker becomes dual purpose as config too.

Yes, that was one solution I thought we'd discussed. The other is storing the initial request in a Set<FileObject> which might have the added benefit that no marker or attribute is created until after initial project load.

Still, what you have looks good, and for user editable configuration, a properties file probably beats the default XML. I know someone on dev@ mentioned YAML, but anything that doesn't need dependencies is a plus.

I have some concerns about having any implementation of Delete (...) Forget

this actually uses the default impl. Dialog has a check box with "also delete project files" which is unchecked by default. So forget is default.

Ah, yes, forgot the default behaviour. Our naming here sucks! 😄

will add screenshots

👍

@jtulach jtulach left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • in #9650 I attempted to need no persistent changes on disk
  • if the general perception is that persistent changes are OK, then...
  • ... I am not going to object

@mbien

mbien commented Oct 26, 2026

Copy link
Copy Markdown
Member Author

Tbh i would see the in-memory approach as an optimization + if i see this correctly there probably isn't anything what would prevent improving this later if needed. But I think it probably isn't a big issue to store a property when a folder was "mounted" -> opted for simplicity.

@mbien

mbien commented Oct 26, 2026

Copy link
Copy Markdown
Member Author

file filter settings + open as generic project action. Since the review started lets call this PR feature complete, additional features would be added via followups unless something essential is still missing.

@mbien
mbien marked this pull request as ready for review October 26, 2026 21:54
</test-dependency>
</test-type>
</test-dependencies>
<public-packages/>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • less API is more ...
    • e.g. I am glad to see there are no public-packages in this generic.project module
  • on the other hand, there are the group="layer" and group="java.io.File" APIs
    • we should document them and expose them at javadoc area
    • however ant javadoc is likely to fail with any package/class being public
    • maybe exposing a single API package with for example MARKER_FILE value?

@neilcsmith-net

Copy link
Copy Markdown
Member

While I agree with @jtulach comment on it being good that there is no API in generic.project, that does not mean that no API/SPI will be required to meet further requirements such as #9737

I'm not in favour of adding the folder action inside project.generic. The action should ideally be registered adjacent to OpenProjectFolderAction in projectui, decoupled from the project type itself, and using whatever API/SPI comes out of that follow-up PR discussion.

Assuming you want to keep this decoupled from #9737 then can we remove the action from this PR? Or alternatively agree it's a placeholder pending replacement on that PR.

@mbien mbien added the JavaDoc [ci] enable java/javadoc tests and build-javadoc target label Oct 27, 2026
@jtulach jtulach closed this Oct 29, 2026
@jtulach jtulach reopened this Oct 29, 2026
@mbien

mbien commented Oct 29, 2026 •

Copy link
Copy Markdown
Member Author

rebase + license fix to get a fresh dev build. Refreshed #9737 too which has now an API.

next on my todo list is to check if non-shared projects are imported on NB version update.

The generic project dir seems to work well (using it while working on other projects for about three weeks by now - it is a convenient way to have multiple separate work trees in the same project group -> agents see only part of the project group). File filter is working too, its refreshing the tree etc.

Majority of followup features would use the API entry point so they would have to get into #9737 or later PRs. I will likely move the open-folder-as-generic-project action to the other PR too as originally planned. But it is here for now since it makes testing easy.

@jtulach jtulach left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestions:

  • make the module an autoload and remove its UI elements
  • move the UI elements out of the autoload into dependant modules
  • use more of <api > tag
  • thanks for filling the arch.xml questionnaire!

Comment thread ide/generic.project/arch.xml Resolved
<code>java.util.Properties</code> file named <code>.nbgp</code> by default,
brandable) or when the
<code>org.netbeans.modules.generic.project</code> FileObject attribute is
set on it (a marker-less "local" project). A generic project is just its

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The attribute would probably fall into <api group="property" .../>

Comment thread ide/generic.project/arch.xml Resolved
<p>
A generic project is a plain directory the user wants to manage as a
project (no build system, no specific language): a collection of documents,
scripts or data files with a folder view and per-project settings.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f projectui depended on this module, it would hardly be disable-able or replaceable! My understanding of @mbien intention is that this is the default implementation of the API/SPI.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any use-case to make this support optional

I remain -1 on having this required to use projectui, or not allowing platform applications to exclude or reimplement generic project support. I also think the API level and the generic project type are two separate things that overlap only in part, and each address other use cases.

I'm -0.9 to making this generic project support not disable-able in the IDE, or not allowing plugins to hook into the API layer.

in fact I would find it very bad if differently configured versions of the IDE supported different marker files

Is that in regard to the branding of shareable marker files? Because my aim in requesting that was that different applications can support different marker files. A generic project configured in one should not automatically be picked up as a project in the other. Yes, reimplementing the whole module could work around that, but the most obvious option in most cases is to re-use the module and brand it.

Comment thread ide/generic.project/arch.xml Resolved
Comment thread ide/generic.project/arch.xml Outdated
</api>
</li>
<li>
<api group="java.io.File" name=".nbgp.private" type="export" category="private">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • the .ngp.private is only useful when using the FileObject attribute, right?
  • why not put the property values as FileObject.setAttribute with some prefix then?
  • then it all be collocated without needing the layer API

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, most project types and the default aux conf use attributes. This was suggested earlier. Not sure if there's a reason not to here? Also these attributes have only been imported on upgrade since #9449 - would need naming carefully or adding to that.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finally found this comment ;)

rewritten: the non-shared settings no longer live in a separate file but in the project's private auxiliary configuration - the same mechanism as all the other project types, so the #9449 upgrader filter already carries them through the import, no new code needed on this side.

however, one edge case remained: a local (marker-less) project that was never customized has only the marker attribute in var/attributes.xml, no auxiliary configuration - the filter drops it and the project is lost after the import. that is why the small change in o.n.upgrader was needed.

Comment thread ide/generic.project/arch.xml Resolved
<answer id="lookup-lookup">
<p>
Yes. Each project's lookup is a composite rooted at
<code>Projects/org-netbeans-modules-generic-project/Lookup</code>, so the

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably <api group="lookup" ../> or layer. Suggestion how to register something into the lookup is recommended. Example is here and here.

Comment thread ide/generic.project/arch.xml Resolved
Comment thread ide/generic.project/arch.xml Resolved
Comment thread ide/generic.project/arch.xml Resolved
@mbien

mbien commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

dear reviewers,

one comment per change request is enough ;). You do not have to mention the exact same thing on 5 different places and link to it. Also please. If I close 4 of the 5 sections, I still see your request - don't worry - there is a reason i left that one section open. You don't have to reopen the sections again so that i can see all 5 duplicates which link to each other. This is horrible to get through. Like whack a mole.

This is also an apache project, and most of the actual discussion should happen on the mailing list. I opened a discussion thread long ago and it still has 0 replies.

As initially said I wanted to help with NB 32, and do mvn and jdk28 update right afterwards before getting back to this. Give me one or two days and I update this PR since those tasks are done.

@mbien

mbien commented Nov 26, 2026

Copy link
Copy Markdown
Member Author

new update for the generic project type which resolves most comments (hard to tell, please check if you commented)

  • removed all commits which were only here to make testing easier
    • 890827c (repo seed)
    • 7f3ac0b (test logging)
    • 16d5318 (GpOpenAsProjectAction) moved to PR2 where it belongs, PR2 will be updated later
  • marker got its .properties file ending + EditableProperties is used so that they remain stable after manual edits (+ no timestamps which Properties added for some reason)
  • arch.xml pass
  • modules were split into generic.project and generic.project.ui across exiting package boundary

additionally:

as sidenote: i tested this together with other PRs (e.g mvn 3.10, jdk28, jgit etc) for weeks, basically all agent work has been using generic projects as workspaces in some form or another. So there is at least some confidence that the common use cases work.

Comment on lines +122 to +134
/**
* The name of the shared auxiliary data file, brandable via the
* module bundle, defaults to {@code .nbgp.properties} (the
* {@code .properties} suffix, so that tools recognize the file
* type): identical to the name of the marker file
* ({@link GenericProject#MARKER_FILE}).
*/
@Messages({
"LBL_aux_data_file_name=.nbgp.properties",
})
static String dataFileName() {
return Bundle.LBL_aux_data_file_name();
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should I remove the dot? kinda forgot about it

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably. If people want to share it, why make it "hidden"?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, will do on next pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) Editor JavaDoc [ci] enable java/javadoc tests and build-javadoc target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants