Re: Plugin manipulating POM files

Benno Markiewicz <[email protected]> Thu, 19 May 2016 22:32:19 +0200
Newsgroups gmane.comp.java.netbeans.devel
Message-ID <CAA_aP4hCmzo3AoCWUVrAxPQOvF5gAo450SZPS3t=X0+SUxWRhg@mail.gmail.com>
Hej Alex,
can you please provide a minimal sample of your maven based nbm-project?
Your generator could print out "Hello World" into the pom, if you do not
want to/can share the real implementation.



With kind regards, markiewb

2016-05-18 22:17 GMT+02:00 AlexFalappa <[email protected]>:

> Hello everybody,
>   I'm coding a NetBeans plugin that should offer a code generator (Alt +
> Ins) inside maven pom.xml files.
> I would like my code generator to behave a lot like the existing "Generate
> Dependency..." code generator and I studied its sources in the
> maven.grammar module
> (org.netbeans.modules.maven.codegen.DependencyGenerator).
> The aforementioned generator manipulates the pom trough a maven pom model
> api contained in the maven.model module that seems to be unaccessible.
>
> I managed to create such a generator in a prototype ant based netbeans
> module project by specifying an implementation dependency on the "Maven
> Editor Model" (codenamebase org.netbeans.modules.maven.model) but I would
> like to do the same in a maven based netbeans module project.
>
> So far I added the following dependencies in the netbeans module project
> pom:
>
> Code:
>
> ...
>         <dependency>
>             <groupId>org.netbeans.api</groupId>
>             <artifactId>org-netbeans-modules-maven-model</artifactId>
>             <version>RELEASE691</version>
>         </dependency>
>         <dependency>
>             <groupId>org.netbeans.api</groupId>
>             <artifactId>org-netbeans-modules-maven-embedder</artifactId>
>             <version>RELEASE691</version>
>         </dependency>
> ...
>
>
>
>
> The latter was required according to the nbm plugin.
> I also specified an implementation dependency by configuring the nbm
> plugin as follows:
>
> Code:
>
>                 <configuration>
>                     <moduleDependencies>
>                         <dependency>
>
> <id>org.netbeans.modules:org-netbeans-modules-maven-model</id>
>                             <type>impl</type>
>                         </dependency>
>                         <dependency>
>
> <id>org.netbeans.modules:org-netbeans-modules-maven-embedder</id>
>                             <type>impl</type>
>
> <explicitValue>org.netbeans.modules.maven.embedder/2 =
> 2.51.1</explicitValue>
>                         </dependency>
>                     </moduleDependencies>
>                 </configuration>
>
>
>
>
> The project compiles fine however when I run the plugin I get the
> following warning:
> Warning - could not install some modules: NB SpringBoot - The module named
> org.netbeans.modules.maven.embedder/1 was needed and not found.
>
> How should I configure the maven project to successfully work like the ant
> based prototype?
>
> Thanks in advance.
>
>
>
>
>