Describe better what you are trying to do:  Modify the POM of a Maven
project, or modify what the IDE thinks is the classpath of it so it offers
completion for some more stuff?

For the former, there's
 - Have an implementation dependency on the Maven module, and call code
internal to it
 - Depend directly on Maven and use Maven's goshawful API for that sort of
thing
 - Find the pom file, analyze it and rewrite what you need (carefully, and
checking parent poms!) - for me, this was the least painful and least
likely to break option

For the latter:
 - Assuming you want to expose a folder under src/main on the classpath,
implement LookupProvider (not Lookup.Provider!), and register it against
the maven project type, e.g. @LookupProvider.Registration(projectTypes =
@LookupProvider.Registration.ProjectType(id = "org-netbeans-modules-maven"))
 - In the lookup that returns, put an object that implements (from the
Maven module's unofficial API - use Yenta) OtherSourcesExclude and
JavaLikeRootProvider to *remove* that source folder from the ones it will
detect as "other sources" (if you skip this step all hell breaks loose)
 - Also include in that lookup your own implementation of Sources which
returns some additional folders when SourceGroup[] getSourceGroups(String
type) is called with "java" - that should allow the ClassPathProvider in
the project to pick it up (and will get you your own "sources" node under
the project)

-Tim

On Tue, Sep 10, 2019 at 2:50 PM joe schmo <geekyguy...@hotmail.com> wrote:

> Does anyone know how to add a directory to the classpath in a Maven based
> project in NetBeans 11.1?
>
> Thanks
>
>
>

-- 
http://timboudreau.com

Reply via email to