You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Nicolas Chalumeau <ni...@gmail.com> on 2005/05/21 02:25:12 UTC
[m2] how to control the plugin execution order
I want to develop a mojo plugin for my project. The goal is to
generate java file from generated java file ie I use modello to
generate my class file but I want to generate interface for this
classes probably with XDoclet2 (GUI component will implement this
interface and extends JFrame for example).
So I want to know how to control the plugin execution in M2? The reply
will may be simple like the same order as in the pom... but I want to
check before star the plugin dev
Nicolas,
PS: if my M2 XDoclet2 plugin research interrest the maven or the
XDoclet2 teams I will be happy to contribute
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: [m2] how to control the plugin execution order
Posted by Nicolas Chalumeau <ni...@gmail.com>.
Hi Anatol
I's actually just a project in my todo list but I will do it as I need
it ;-). I let you know when it will be ready. Do you want I open an
issue for this (xdoclet2 project or xdoclet2 plugin project ?)
Nicolas
On 5/23/05, Anatol Pomozov <an...@gmail.com> wrote:
> > PS: if my M2 XDoclet2 plugin research interrest the maven or the
> > XDoclet2 teams I will be happy to contribute
>
> We are (xdoclet2 team) glad to hear it. If you think that your plugin
> ready for cruise please create new ticket
> http://jira.codehaus.org/browse/XDOCLET and attach sources to them.
>
> --
> anatol
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: [m2] how to control the plugin execution order
Posted by Anatol Pomozov <an...@gmail.com>.
> PS: if my M2 XDoclet2 plugin research interrest the maven or the
> XDoclet2 teams I will be happy to contribute
We are (xdoclet2 team) glad to hear it. If you think that your plugin
ready for cruise please create new ticket
http://jira.codehaus.org/browse/XDOCLET and attach sources to them.
--
anatol
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: [m2] writing a plugin that generates Java code
Posted by Brett Porter <br...@gmail.com>.
On 5/23/05, J. Matthew Pryor <jm...@mobiquity.net> wrote:
> In general, aside from the noted lack of documentation (once again happy to
> provide support here) I think the basic approach is the right one.
Cool. BTW, did you get my recent email about the pluginManagement docs
you wrote? (4 days ago).
> So here are you talking about the plugin or the project that uses the
> plugin?
The goal definition needs to go into the project to tell Maven to
register the goal in the lifecycle. eg:
http://svn.apache.org/viewcvs.cgi/maven/components/trunk/maven-model/pom.xml?rev=169961&view=markup
> Assuming the later, I did this:
This went missing, but I assume you got it right.
>
> And got this:
>
Based on the location of the error, you are using alpha-1. Plugins
with arbitrary IDs are only supported from alpha-2 (note that this
required some heavy changes to the mojo API, but that is what is
documented on the site. So you probably want to switch to alpha-2
anyway, but it will mean regenerating your plugins after the change as
it was not backwards compatible).
Hope this helps!
- Brett
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: [m2] writing a plugin that generates Java code
Posted by "J. Matthew Pryor" <jm...@mobiquity.net>.
In general, aside from the noted lack of documentation (once again happy to
provide support here) I think the basic approach is the right one.
Writing a Mojo with javadoc tags is definitely nice & straightforward.
What I am confused about is how my new plugin actually gets called. I
basically get the whole lifecycle/phase thing, I that on the money AFAIAC,
but what I can't quite get is connecting the new plugin with the project
that needs the code generated.
> The problem is that you need to add
> <goals><goal><id>bean</id></goal></goals> to the plugin
> configuration to tell Maven to register the goal with the phase.
>
So here are you talking about the plugin or the project that uses the
plugin?
Assuming the later, I did this:
And got this:
[INFO] intermedi8-protege-plugin: using locally installed snapshot
FATAL ERROR: Error executing Maven for a project
org.apache.maven.reactor.ReactorException: Error executing project within
the reactor
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:144)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:217)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:303)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:243)
at
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:416)
at org.codehaus.classworlds.Launcher.main(Launcher.java:363)
Caused by: org.apache.maven.lifecycle.LifecycleExecutionException: A goal
'protege:bean' was declared in pom.xml, but does not exist
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.processPluginPhases(Defa
ultLifecycleExecutor.java:293)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.processPluginConfigurati
on(DefaultLifecycleExecutor.java:240)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.processGoals(DefaultLife
cycleExecutor.java:152)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycle
Executor.java:94)
at
org.apache.maven.DefaultMaven.processProject(DefaultMaven.java:222)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:136)
... 9 more
Very happy to keep plugigng away to get this resolved
Matthew
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: [m2] writing a plugin that generates Java code
Posted by Brett Porter <br...@gmail.com>.
On 5/23/05, J. Matthew Pryor <jm...@mobiquity.net> wrote:
> That was a copy & paste issue. I copied the javadoc tag from the IdeaPlugin.
>
> I changed that javadoc tag & now get
>
> <phase>generate-sources</phase>
>
> I also fixed a bunch of typos & also removed the intermediate
> AbstractGeneratorMojo (the NPE issue that was a red herring), so now I get
> no errors, but no evidence of my plugin getting called
Ok, sorry for following the red herring.
> How can I get better information about what plugins are getting called?
If it is called, [protege:bean] would appear.
The problem is that you need to add
<goals><goal><id>bean</id></goal></goals> to the plugin configuration
to tell Maven to register the goal with the phase.
Apart from the fact this all needs to be documented (which will happen
at the end of the week when everything else is finalised), do you
agree this is the right way to do it? One of the aims is for there to
be minimal magic as well as minimal configuration so it is fairly
obvious looking at a POM what will happen.
It will probably be possible to let a plugin, once configured,
auto-register some goals (like the packaging ones do), by the end of
the week when the design is implemented (first section of
http://docs.codehaus.org/display/MAVEN/Lifecycle).
- Brett
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: [m2] writing a plugin that generates Java code
Posted by "J. Matthew Pryor" <jm...@mobiquity.net>.
That was a copy & paste issue. I copied the javadoc tag from the IdeaPlugin.
I changed that javadoc tag & now get
<phase>generate-sources</phase>
I also fixed a bunch of typos & also removed the intermediate
AbstractGeneratorMojo (the NPE issue that was a red herring), so now I get
no errors, but no evidence of my plugin getting called
[INFO] Building Intermedi8 Core
[INFO]
----------------------------------------------------------------------------
[INFO] intermedi8-protege-plugin: using locally installed snapshot
[INFO] [resources:resources]
[INFO] intermedi8-roadmap-plugin: using locally installed snapshot
[INFO] [compiler:compile]
[INFO] No sources to compile
[INFO] [resources:testResources]
[INFO] [compiler:testCompile]
[INFO] No sources to compile
[INFO] [surefire:test]
[INFO] Setting reports dir:
C:\proj\682\apps\intermedi8\intermedi8-core\target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
There are no test to run.
Results :
[surefire] Tests run: 0, Failures: 0, Errors: 0
[INFO] [jar:jar]
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar:
C:\proj\682\apps\intermedi8\intermedi8-core\target\intermedi8-core-0.1-SNAPS
HOT.jar
[INFO] [install:install]
[INFO] Installing
C:\proj\682\apps\intermedi8\intermedi8-core\target\intermedi8-core-0.1-SNAPS
HOT.jar to C:\Documents and Settings\m
pryor\.m2\repository\net\mobiquity\intermedi8-core\0.1-SNAPSHOT\intermedi8-c
ore-0.1-SNAPSHOT.jar
[INFO]
----------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO]
----------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Mon May 23 11:20:13 EST 2005
[INFO] Final Memory: 2M/4M
[INFO]
----------------------------------------------------------------------------
How can I get better information about what plugins are getting called?
Any other hints to get a better diagnosis?
Thanks,
Matthew
> -----Original Message-----
> From: Brett Porter [mailto:brett.porter@gmail.com]
> Sent: Monday, May 23, 2005 11:12 AM
> To: jmp@mobiquity.net
> Cc: Maven Users List
> Subject: Re: [m2] writing a plugin that generates Java code
>
> The <executePhase> part looks incorrect to me, and might
> explain the problem as it would essentially setup an infinite
> loop in the lifecycle and might explain why the plugin
> version isn't discovered.
>
> Regardless, this would be a bug that it is not reported as an
> error properly.
>
> I'm not sure why it is there, given you don't list it in your javadoc.
> Can you confirm that it really is the same?
>
> Thanks,
> Brett
>
> On 5/23/05, J. Matthew Pryor <jm...@mobiquity.net> wrote:
> > I am trying to write a plugin that will generate source
> code prior to
> > compilation, but the plugin fails when it gets called.
> >
> > The plugin looks like this:
> >
> > /**
> > * @phase generate-sources
> > * @goal bean
> > * @author mpryor
> > *
> > */
> > public class ProtegeBeanGeneratorMojo extends
> AbstractGeneratorMojo {
> >
> > /**
> > * @parameter
> expression="${project.build.directory}/generated-sources"
> > * @required
> > */
> > protected File outputDirectory;
> > [snip]
> > }
> >
> > POM snippet
> >
> > <project>
> > <modelVersion>4.0.0</modelVersion>
> > <parent>
> > <artifactId>intermedi8-parent</artifactId>
> > <groupId>net.mobiquity</groupId>
> > <version>0.1-SNAPSHOT</version>
> > </parent>
> > <artifactId>intermedi8-protege-plugin</artifactId>
> > <version>0.1-SNAPSHOT</version>
> > <packaging>maven-plugin</packaging>
> > <name>Intermedi8 Protege Plugin</name>
> > <dependencies>
> >
> > It builds and installs fine, with what appears to be a well formed
> > plugin.xml:
> >
> > <plugin>
> > <groupId>net.mobiquity</groupId>
> > <artifactId>intermedi8-protege-plugin</artifactId>
> > <isolatedRealm>true</isolatedRealm>
> > <mojos>
> > <mojo>
> > <id>protege:bean</id>
> >
> <requiresDependencyResolution>runtime</requiresDependencyResolution>
> > <phase>generate-sources</phase>
> > <executePhase>generate-sources</executePhase>
> >
> >
> <implementation>net.mobiquity.intermedi8.tools.protege.ProtegeBeanGene
> > ratorM
> > ojo</implementation>
> > <language>java</language>
> > <instantiationStrategy>per-lookup</instantiationStrategy>
> > <executionStrategy>once-per-session</executionStrategy>
> > <parameters>
> > <parameter>
> > [snip]
> >
> > I have another project that uses the plugin, configured like this:
> >
> >
> > <build>
> > <plugins>
> > <plugin>
> > <groupId>net.mobiquity</groupId>
> > <artifactId>intermedi8-protege-plugin</artifactId>
> > <version>0.1-SNAPSHOT</version>
> > <configuration>
> >
> >
> <protogeProject>${maven.src.dir}/ontology/intermedi8.pprj/</pr
> otogeProject>
> > </configuration>
> > </plugin>
> > </plugins>
> >
> > But the build fails with the following :
> >
> > C:\proj\682\apps\intermedi8\intermedi8-core>m2 -X -e install [INFO]
> > intermedi8-parent: using locally installed snapshot [INFO]
> >
> ----------------------------------------------------------------------
> > ------
> > [INFO] Building Intermedi8 Core
> > [INFO]
> >
> ----------------------------------------------------------------------
> > ------ [INFO] maven-jar-plugin: using locally installed snapshot
> > [INFO] maven-archiver: using locally installed snapshot
> [INFO] maven:
> > using locally installed snapshot [INFO] intermedi8-protege-plugin:
> > using locally installed snapshot [INFO]
> maven-resources-plugin: using
> > locally installed snapshot [INFO] maven-compiler-plugin:
> using locally
> > installed snapshot [INFO] plexus-compiler-api: using
> locally installed
> > snapshot [INFO] plexus-compiler: using locally installed snapshot
> > [INFO] plexus-compiler-javac: using locally installed
> snapshot [INFO]
> > plexus-compilers: using locally installed snapshot [INFO]
> > maven-surefire-plugin: using locally installed snapshot [INFO]
> > maven-install-plugin: using locally installed snapshot
> > ---------------------------------------------------
> > constituent[0]:
> > file:/C:/dev/maven/m2dev/lib/commons-cli-1.0-beta-2.jar
> > constituent[1]:
> > file:/C:/dev/maven/m2dev/lib/maven-artifact-2.0-SNAPSHOT.jar
> > constituent[2]:
> > file:/C:/dev/maven/m2dev/lib/maven-core-2.0-SNAPSHOT.jar
> > constituent[3]:
> > file:/C:/dev/maven/m2dev/lib/maven-model-2.0-SNAPSHOT.jar
> > constituent[4]:
> > file:/C:/dev/maven/m2dev/lib/maven-monitor-2.0-SNAPSHOT.jar
> > constituent[5]:
> > file:/C:/dev/maven/m2dev/lib/maven-plugin-api-2.0-SNAPSHOT.jar
> > constituent[6]:
> >
> file:/C:/dev/maven/m2dev/lib/maven-plugin-descriptor-2.0-SNAPSHOT.jar
> > constituent[7]:
> > file:/C:/dev/maven/m2dev/lib/maven-project-2.0-SNAPSHOT.jar
> > constituent[8]:
> > file:/C:/dev/maven/m2dev/lib/maven-settings-2.0-SNAPSHOT.jar
> > constituent[9]:
> >
> file:/C:/dev/maven/m2dev/lib/plexus-container-artifact-1.0-alp
> ha-3-SNAPSHOT.
> > jar
> > constituent[10]:
> > file:/C:/dev/maven/m2dev/lib/plexus-i18n-1.0-beta-3.jar
> > constituent[11]:
> >
> file:/C:/dev/maven/m2dev/lib/wagon-http-lightweight-1.0-alpha-3-SNAPSH
> > OT.jar
> > constituent[12]:
> >
> file:/C:/dev/maven/m2dev/lib/wagon-provider-api-1.0-alpha-3-SNAPSHOT.j
> > ar
> > ---------------------------------------------------
> > java.lang.NullPointerException: version was null for
> > org.apache.maven.plugins:maven-protege-plugin
> > at
> >
> org.apache.maven.artifact.DefaultArtifact.getBaseVersion(DefaultArtifa
> > ct.jav
> > a:246)
> > at
> >
> org.apache.maven.artifact.DefaultArtifact.getId(DefaultArtifac
> t.java:159)
> > at
> >
> org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(Def
> > aultAr
> > tifactResolver.java:77)
> > at
> >
> org.codehaus.plexus.DefaultArtifactEnabledContainer.addComponent(Defau
> > ltArti
> > factEnabledContainer.java:104)
> > at
> >
> org.apache.maven.plugin.DefaultPluginManager.addPlugin(Default
> PluginManager.
> > java:282)
> > at
> >
> org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPlugi
> > nManag
> > er.java:241)
> > at
> >
> org.apache.maven.plugin.DefaultPluginManager.verifyPluginForGoal(Defau
> > ltPlug
> > inManager.java:195)
> > at
> >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeMojo(Defaul
> > tLifec
> > ycleExecutor.java:478)
> > at
> >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executePhase(Defau
> > ltLife
> > cycleExecutor.java:436)
> > at
> >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.processGoals(Defau
> > ltLife
> > cycleExecutor.java:164)
> > at
> >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLif
> > ecycle
> > Executor.java:94)
> > at
> > org.apache.maven.DefaultMaven.processProject(DefaultMaven.java:222)
> > at
> org.apache.maven.DefaultMaven.execute(DefaultMaven.java:136)
> > at org.apache.maven.cli.MavenCli.main(MavenCli.java:217)
> > at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j
> > ava:39
> > )
> > at
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
> > orImpl
> > .java:25)
> > at java.lang.reflect.Method.invoke(Method.java:324)
> > at
> > org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:303)
> > at
> org.codehaus.classworlds.Launcher.launch(Launcher.java:243)
> > at
> >
> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:416)
> > at org.codehaus.classworlds.Launcher.main(Launcher.java:363)
> >
> >
> > Any clues as to what I have done wrong ?
> >
> > Thanks,
> > Matthew
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: [m2] writing a plugin that generates Java code
Posted by Brett Porter <br...@gmail.com>.
The <executePhase> part looks incorrect to me, and might explain the
problem as it would essentially setup an infinite loop in the
lifecycle and might explain why the plugin version isn't discovered.
Regardless, this would be a bug that it is not reported as an error properly.
I'm not sure why it is there, given you don't list it in your javadoc.
Can you confirm that it really is the same?
Thanks,
Brett
On 5/23/05, J. Matthew Pryor <jm...@mobiquity.net> wrote:
> I am trying to write a plugin that will generate source code prior to
> compilation, but the plugin fails when it gets called.
>
> The plugin looks like this:
>
> /**
> * @phase generate-sources
> * @goal bean
> * @author mpryor
> *
> */
> public class ProtegeBeanGeneratorMojo extends AbstractGeneratorMojo {
>
> /**
> * @parameter expression="${project.build.directory}/generated-sources"
> * @required
> */
> protected File outputDirectory;
> [snip]
> }
>
> POM snippet
>
> <project>
> <modelVersion>4.0.0</modelVersion>
> <parent>
> <artifactId>intermedi8-parent</artifactId>
> <groupId>net.mobiquity</groupId>
> <version>0.1-SNAPSHOT</version>
> </parent>
> <artifactId>intermedi8-protege-plugin</artifactId>
> <version>0.1-SNAPSHOT</version>
> <packaging>maven-plugin</packaging>
> <name>Intermedi8 Protege Plugin</name>
> <dependencies>
>
> It builds and installs fine, with what appears to be a well formed
> plugin.xml:
>
> <plugin>
> <groupId>net.mobiquity</groupId>
> <artifactId>intermedi8-protege-plugin</artifactId>
> <isolatedRealm>true</isolatedRealm>
> <mojos>
> <mojo>
> <id>protege:bean</id>
> <requiresDependencyResolution>runtime</requiresDependencyResolution>
> <phase>generate-sources</phase>
> <executePhase>generate-sources</executePhase>
>
> <implementation>net.mobiquity.intermedi8.tools.protege.ProtegeBeanGeneratorM
> ojo</implementation>
> <language>java</language>
> <instantiationStrategy>per-lookup</instantiationStrategy>
> <executionStrategy>once-per-session</executionStrategy>
> <parameters>
> <parameter>
> [snip]
>
> I have another project that uses the plugin, configured like this:
>
>
> <build>
> <plugins>
> <plugin>
> <groupId>net.mobiquity</groupId>
> <artifactId>intermedi8-protege-plugin</artifactId>
> <version>0.1-SNAPSHOT</version>
> <configuration>
>
> <protogeProject>${maven.src.dir}/ontology/intermedi8.pprj/</protogeProject>
> </configuration>
> </plugin>
> </plugins>
>
> But the build fails with the following :
>
> C:\proj\682\apps\intermedi8\intermedi8-core>m2 -X -e install
> [INFO] intermedi8-parent: using locally installed snapshot
> [INFO]
> ----------------------------------------------------------------------------
> [INFO] Building Intermedi8 Core
> [INFO]
> ----------------------------------------------------------------------------
> [INFO] maven-jar-plugin: using locally installed snapshot
> [INFO] maven-archiver: using locally installed snapshot
> [INFO] maven: using locally installed snapshot
> [INFO] intermedi8-protege-plugin: using locally installed snapshot
> [INFO] maven-resources-plugin: using locally installed snapshot
> [INFO] maven-compiler-plugin: using locally installed snapshot
> [INFO] plexus-compiler-api: using locally installed snapshot
> [INFO] plexus-compiler: using locally installed snapshot
> [INFO] plexus-compiler-javac: using locally installed snapshot
> [INFO] plexus-compilers: using locally installed snapshot
> [INFO] maven-surefire-plugin: using locally installed snapshot
> [INFO] maven-install-plugin: using locally installed snapshot
> ---------------------------------------------------
> constituent[0]: file:/C:/dev/maven/m2dev/lib/commons-cli-1.0-beta-2.jar
> constituent[1]: file:/C:/dev/maven/m2dev/lib/maven-artifact-2.0-SNAPSHOT.jar
> constituent[2]: file:/C:/dev/maven/m2dev/lib/maven-core-2.0-SNAPSHOT.jar
> constituent[3]: file:/C:/dev/maven/m2dev/lib/maven-model-2.0-SNAPSHOT.jar
> constituent[4]: file:/C:/dev/maven/m2dev/lib/maven-monitor-2.0-SNAPSHOT.jar
> constituent[5]:
> file:/C:/dev/maven/m2dev/lib/maven-plugin-api-2.0-SNAPSHOT.jar
> constituent[6]:
> file:/C:/dev/maven/m2dev/lib/maven-plugin-descriptor-2.0-SNAPSHOT.jar
> constituent[7]: file:/C:/dev/maven/m2dev/lib/maven-project-2.0-SNAPSHOT.jar
> constituent[8]: file:/C:/dev/maven/m2dev/lib/maven-settings-2.0-SNAPSHOT.jar
> constituent[9]:
> file:/C:/dev/maven/m2dev/lib/plexus-container-artifact-1.0-alpha-3-SNAPSHOT.
> jar
> constituent[10]: file:/C:/dev/maven/m2dev/lib/plexus-i18n-1.0-beta-3.jar
> constituent[11]:
> file:/C:/dev/maven/m2dev/lib/wagon-http-lightweight-1.0-alpha-3-SNAPSHOT.jar
> constituent[12]:
> file:/C:/dev/maven/m2dev/lib/wagon-provider-api-1.0-alpha-3-SNAPSHOT.jar
> ---------------------------------------------------
> java.lang.NullPointerException: version was null for
> org.apache.maven.plugins:maven-protege-plugin
> at
> org.apache.maven.artifact.DefaultArtifact.getBaseVersion(DefaultArtifact.jav
> a:246)
> at
> org.apache.maven.artifact.DefaultArtifact.getId(DefaultArtifact.java:159)
> at
> org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultAr
> tifactResolver.java:77)
> at
> org.codehaus.plexus.DefaultArtifactEnabledContainer.addComponent(DefaultArti
> factEnabledContainer.java:104)
> at
> org.apache.maven.plugin.DefaultPluginManager.addPlugin(DefaultPluginManager.
> java:282)
> at
> org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManag
> er.java:241)
> at
> org.apache.maven.plugin.DefaultPluginManager.verifyPluginForGoal(DefaultPlug
> inManager.java:195)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeMojo(DefaultLifec
> ycleExecutor.java:478)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executePhase(DefaultLife
> cycleExecutor.java:436)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.processGoals(DefaultLife
> cycleExecutor.java:164)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycle
> Executor.java:94)
> at
> org.apache.maven.DefaultMaven.processProject(DefaultMaven.java:222)
> at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:136)
> at org.apache.maven.cli.MavenCli.main(MavenCli.java:217)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
> )
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> .java:25)
> at java.lang.reflect.Method.invoke(Method.java:324)
> at
> org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:303)
> at org.codehaus.classworlds.Launcher.launch(Launcher.java:243)
> at
> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:416)
> at org.codehaus.classworlds.Launcher.main(Launcher.java:363)
>
>
> Any clues as to what I have done wrong ?
>
> Thanks,
> Matthew
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
[m2] writing a plugin that generates Java code
Posted by "J. Matthew Pryor" <jm...@mobiquity.net>.
I am trying to write a plugin that will generate source code prior to
compilation, but the plugin fails when it gets called.
The plugin looks like this:
/**
* @phase generate-sources
* @goal bean
* @author mpryor
*
*/
public class ProtegeBeanGeneratorMojo extends AbstractGeneratorMojo {
/**
* @parameter expression="${project.build.directory}/generated-sources"
* @required
*/
protected File outputDirectory;
[snip]
}
POM snippet
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>intermedi8-parent</artifactId>
<groupId>net.mobiquity</groupId>
<version>0.1-SNAPSHOT</version>
</parent>
<artifactId>intermedi8-protege-plugin</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
<name>Intermedi8 Protege Plugin</name>
<dependencies>
It builds and installs fine, with what appears to be a well formed
plugin.xml:
<plugin>
<groupId>net.mobiquity</groupId>
<artifactId>intermedi8-protege-plugin</artifactId>
<isolatedRealm>true</isolatedRealm>
<mojos>
<mojo>
<id>protege:bean</id>
<requiresDependencyResolution>runtime</requiresDependencyResolution>
<phase>generate-sources</phase>
<executePhase>generate-sources</executePhase>
<implementation>net.mobiquity.intermedi8.tools.protege.ProtegeBeanGeneratorM
ojo</implementation>
<language>java</language>
<instantiationStrategy>per-lookup</instantiationStrategy>
<executionStrategy>once-per-session</executionStrategy>
<parameters>
<parameter>
[snip]
I have another project that uses the plugin, configured like this:
<build>
<plugins>
<plugin>
<groupId>net.mobiquity</groupId>
<artifactId>intermedi8-protege-plugin</artifactId>
<version>0.1-SNAPSHOT</version>
<configuration>
<protogeProject>${maven.src.dir}/ontology/intermedi8.pprj/</protogeProject>
</configuration>
</plugin>
</plugins>
But the build fails with the following :
C:\proj\682\apps\intermedi8\intermedi8-core>m2 -X -e install
[INFO] intermedi8-parent: using locally installed snapshot
[INFO]
----------------------------------------------------------------------------
[INFO] Building Intermedi8 Core
[INFO]
----------------------------------------------------------------------------
[INFO] maven-jar-plugin: using locally installed snapshot
[INFO] maven-archiver: using locally installed snapshot
[INFO] maven: using locally installed snapshot
[INFO] intermedi8-protege-plugin: using locally installed snapshot
[INFO] maven-resources-plugin: using locally installed snapshot
[INFO] maven-compiler-plugin: using locally installed snapshot
[INFO] plexus-compiler-api: using locally installed snapshot
[INFO] plexus-compiler: using locally installed snapshot
[INFO] plexus-compiler-javac: using locally installed snapshot
[INFO] plexus-compilers: using locally installed snapshot
[INFO] maven-surefire-plugin: using locally installed snapshot
[INFO] maven-install-plugin: using locally installed snapshot
---------------------------------------------------
constituent[0]: file:/C:/dev/maven/m2dev/lib/commons-cli-1.0-beta-2.jar
constituent[1]: file:/C:/dev/maven/m2dev/lib/maven-artifact-2.0-SNAPSHOT.jar
constituent[2]: file:/C:/dev/maven/m2dev/lib/maven-core-2.0-SNAPSHOT.jar
constituent[3]: file:/C:/dev/maven/m2dev/lib/maven-model-2.0-SNAPSHOT.jar
constituent[4]: file:/C:/dev/maven/m2dev/lib/maven-monitor-2.0-SNAPSHOT.jar
constituent[5]:
file:/C:/dev/maven/m2dev/lib/maven-plugin-api-2.0-SNAPSHOT.jar
constituent[6]:
file:/C:/dev/maven/m2dev/lib/maven-plugin-descriptor-2.0-SNAPSHOT.jar
constituent[7]: file:/C:/dev/maven/m2dev/lib/maven-project-2.0-SNAPSHOT.jar
constituent[8]: file:/C:/dev/maven/m2dev/lib/maven-settings-2.0-SNAPSHOT.jar
constituent[9]:
file:/C:/dev/maven/m2dev/lib/plexus-container-artifact-1.0-alpha-3-SNAPSHOT.
jar
constituent[10]: file:/C:/dev/maven/m2dev/lib/plexus-i18n-1.0-beta-3.jar
constituent[11]:
file:/C:/dev/maven/m2dev/lib/wagon-http-lightweight-1.0-alpha-3-SNAPSHOT.jar
constituent[12]:
file:/C:/dev/maven/m2dev/lib/wagon-provider-api-1.0-alpha-3-SNAPSHOT.jar
---------------------------------------------------
java.lang.NullPointerException: version was null for
org.apache.maven.plugins:maven-protege-plugin
at
org.apache.maven.artifact.DefaultArtifact.getBaseVersion(DefaultArtifact.jav
a:246)
at
org.apache.maven.artifact.DefaultArtifact.getId(DefaultArtifact.java:159)
at
org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultAr
tifactResolver.java:77)
at
org.codehaus.plexus.DefaultArtifactEnabledContainer.addComponent(DefaultArti
factEnabledContainer.java:104)
at
org.apache.maven.plugin.DefaultPluginManager.addPlugin(DefaultPluginManager.
java:282)
at
org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManag
er.java:241)
at
org.apache.maven.plugin.DefaultPluginManager.verifyPluginForGoal(DefaultPlug
inManager.java:195)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeMojo(DefaultLifec
ycleExecutor.java:478)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executePhase(DefaultLife
cycleExecutor.java:436)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.processGoals(DefaultLife
cycleExecutor.java:164)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycle
Executor.java:94)
at
org.apache.maven.DefaultMaven.processProject(DefaultMaven.java:222)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:136)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:217)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:303)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:243)
at
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:416)
at org.codehaus.classworlds.Launcher.main(Launcher.java:363)
Any clues as to what I have done wrong ?
Thanks,
Matthew
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: [m2] how to control the plugin execution order
Posted by Brett Porter <br...@gmail.com>.
Hi Nicolas,
On 5/21/05, Nicolas Chalumeau <ni...@gmail.com> wrote:
> I want to develop a mojo plugin for my project. The goal is to
> generate java file from generated java file ie I use modello to
> generate my class file but I want to generate interface for this
> classes probably with XDoclet2 (GUI component will implement this
> interface and extends JFrame for example).
> So I want to know how to control the plugin execution in M2? The reply
> will may be simple like the same order as in the pom... but I want to
> check before star the plugin dev
The order is determined by the build lifecycle. You probably want:
@phase generate-sources
in your plugin.
Within phases, order is currently indeterminate, but we intend for it
to be the order in the POM.
> PS: if my M2 XDoclet2 plugin research interrest the maven or the
> XDoclet2 teams I will be happy to contribute
In general I'd like to see it contributed to and maintained by the
product itself (i XDoclet2) if possible, but would definitely be
interested to hear how it goes and if there are any improvements
needed. We can also list it on the web site.
- Brett
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org