Re: my plugins rely on maven plugin but don't know how to load it programatically
I have used its API in my antlr plugins and would be happy to look it over. On Wed, Jul 20, 2022 at 12:31 PM Svata Dedic wrote: > It is, but I'd like at least some time (and ideally some > colleague/companion for the work - it's big) for +- reviewing / > polishing the API before publishing > > -S. > > On 20. 07. 22 17:45, Neil C Smith wrote: > > On Tue, 19 Jul 2022 at 21:36, Svata Dedic > wrote: > >> > >> On 19. 07. 22 18:32, Peter Cheung wrote: > >>> Hi > >>> > >>> I am creating a new project type for RISC-V. The below code only > work when my netbeans loaded maven plugin. Is it possible to let netbeans > load my plugin and auto load maven plugin together? > >>> > >> > >> Well, that's bad. Maven module's API is just 'friend API'; so it is only > >> available to a certain set of modules. Mainly because the API is too > >> broad and the original author perhaps did not feel (?) it's rock solid > >> to be published and maintained for good. > >> > >> If it was a regular API, you could just add a module dependency. > > > > Well, I'll +1 a PR to stop it being a friend API. It's been like that > > for a long time, it's got a friends list as long as your arm, some of > > which are external. It's just API by stealth now. > > > > Best wishes, > > > > 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 > > > > > > > > > - > 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 > > > > -- http://timboudreau.com
Re: my plugins rely on maven plugin but don't know how to load it programatically
It is, but I'd like at least some time (and ideally some colleague/companion for the work - it's big) for +- reviewing / polishing the API before publishing -S. On 20. 07. 22 17:45, Neil C Smith wrote: On Tue, 19 Jul 2022 at 21:36, Svata Dedic wrote: On 19. 07. 22 18:32, Peter Cheung wrote: Hi I am creating a new project type for RISC-V. The below code only work when my netbeans loaded maven plugin. Is it possible to let netbeans load my plugin and auto load maven plugin together? Well, that's bad. Maven module's API is just 'friend API'; so it is only available to a certain set of modules. Mainly because the API is too broad and the original author perhaps did not feel (?) it's rock solid to be published and maintained for good. If it was a regular API, you could just add a module dependency. Well, I'll +1 a PR to stop it being a friend API. It's been like that for a long time, it's got a friends list as long as your arm, some of which are external. It's just API by stealth now. Best wishes, 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 - 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
Re: my plugins rely on maven plugin but don't know how to load it programatically
On Tue, 19 Jul 2022 at 21:36, Svata Dedic wrote: > > On 19. 07. 22 18:32, Peter Cheung wrote: > > Hi > > > > I am creating a new project type for RISC-V. The below code only work > > when my netbeans loaded maven plugin. Is it possible to let netbeans load > > my plugin and auto load maven plugin together? > > > > Well, that's bad. Maven module's API is just 'friend API'; so it is only > available to a certain set of modules. Mainly because the API is too > broad and the original author perhaps did not feel (?) it's rock solid > to be published and maintained for good. > > If it was a regular API, you could just add a module dependency. Well, I'll +1 a PR to stop it being a friend API. It's been like that for a long time, it's got a friends list as long as your arm, some of which are external. It's just API by stealth now. Best wishes, 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
Re: my plugins rely on maven plugin but don't know how to load it programatically
On 19. 07. 22 18:32, Peter Cheung wrote: Hi I am creating a new project type for RISC-V. The below code only work when my netbeans loaded maven plugin. Is it possible to let netbeans load my plugin and auto load maven plugin together? Well, that's bad. Maven module's API is just 'friend API'; so it is only available to a certain set of modules. Mainly because the API is too broad and the original author perhaps did not feel (?) it's rock solid to be published and maintained for good. If it was a regular API, you could just add a module dependency. You may consider to make an "implementation dependency" on Maven Projects module -- https://netbeans.apache.org/wiki/DevFaqImplementationDependency.asciidoc --%< from project.xml of the dependent module -%<-- org.netbeans.modules.maven 2 --%<%<-%<-- But please read carefully to understand the consequences. But the reflection is really ugly -S. How can my netbeans modules got the mvn path? i found "mavenHome = EmbedderFactory.getEffectiveMavenHome();" in netbeans source code but I don't have class EmbedderFactory ClassLoader syscl = Lookup.getDefault().lookup(ClassLoader.class); System.out.println(syscl); List goals = new ArrayList<>(); goals.add("compile"); ProjectInformation projectInformation = ProjectUtils.getInformation(this); Class runUtils = syscl.loadClass("org.netbeans.modules.maven.api.execute.RunUtils"); Method createRunConfig = runUtils.getMethod("createRunConfig", new Class[]{File.class, Project.class, String.class, List.class}); Object rc = createRunConfig.invoke(null, FileUtil.toFile(this.projectDir), this, projectInformation.getDisplayName(), goals); Class runConfig = syscl.loadClass("org.netbeans.modules.maven.api.execute.RunConfig"); // maven properties Method setProperty = runConfig.getMethod("addProperties", new Class[]{Map.class}); Map properties = new HashMap<>(); setProperty.invoke(rc, properties); // maven profile Method setActivatedProfiles = runConfig.getMethod("setActivatedProfiles", new Class[]{java.util.List.class}); List profiles = new ArrayList<>(); profiles.add("dev"); profiles.add("prod"); setActivatedProfiles.invoke(rc, profiles); Method executeMaven = runUtils.getMethod("executeMaven", new Class[]{runConfig}); executeMaven.invoke(null, rc); Thanks From Peter (System Architect, Quantr Limited https://www.quantr.hk , Mobile : 96554595) - 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
my plugins rely on maven plugin but don't know how to load it programatically
Hi I am creating a new project type for RISC-V. The below code only work when my netbeans loaded maven plugin. Is it possible to let netbeans load my plugin and auto load maven plugin together? How can my netbeans modules got the mvn path? i found "mavenHome = EmbedderFactory.getEffectiveMavenHome();" in netbeans source code but I don't have class EmbedderFactory ClassLoader syscl = Lookup.getDefault().lookup(ClassLoader.class); System.out.println(syscl); List goals = new ArrayList<>(); goals.add("compile"); ProjectInformation projectInformation = ProjectUtils.getInformation(this); Class runUtils = syscl.loadClass("org.netbeans.modules.maven.api.execute.RunUtils"); Method createRunConfig = runUtils.getMethod("createRunConfig", new Class[]{File.class, Project.class, String.class, List.class}); Object rc = createRunConfig.invoke(null, FileUtil.toFile(this.projectDir), this, projectInformation.getDisplayName(), goals); Class runConfig = syscl.loadClass("org.netbeans.modules.maven.api.execute.RunConfig"); // maven properties Method setProperty = runConfig.getMethod("addProperties", new Class[]{Map.class}); Map properties = new HashMap<>(); setProperty.invoke(rc, properties); // maven profile Method setActivatedProfiles = runConfig.getMethod("setActivatedProfiles", new Class[]{java.util.List.class}); List profiles = new ArrayList<>(); profiles.add("dev"); profiles.add("prod"); setActivatedProfiles.invoke(rc, profiles); Method executeMaven = runUtils.getMethod("executeMaven", new Class[]{runConfig}); executeMaven.invoke(null, rc); Thanks >From Peter (System Architect, Quantr Limited https://www.quantr.hk , Mobile : >96554595)