You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Matthew Pryor <mp...@agentissoftware.com> on 2005/07/04 04:04:10 UTC

help with custom lifecycle

I am trying to write/refine the mevenide Eclise PDE builder maven2 plugin.

 

In essence what this plugin needs to do is to read an XML file (plugin.xml)
and add a bunch of jar files to the classpath prior to compilation or
testing.

 

I have all the latest source for m2 and am not 100% sure about the right
approach, but I think I will start with a custom lifecycle what will class a
slight modified compiler that add the 'private' Eclipse PDE dependencies

 

<side-note>

            I suppose I could go down the path of trying to treat the
Eclipse specific stuff as real dependencies and create artifacts for them
and write a custom artifact handler that could read them from the Eclipse
plugins folder, but I think that would be a lot of code and not be that much
better than simply adding the jar files to the classpath before calling the
AbstractCompilerMojo - private API issues aside

</side-note>

 

So my question is, after having read
http://maven.apache.org/maven2/lifecycle.html and attempting to follow it, I
get the following 

 

[INFO] Deleting directory C:\proj\m2\workspace\m2-plugin-test\target

[ERROR] Nonexistent component:
org.apache.maven.lifecycle.mapping.LifecycleMappingeclipse-plugin

[ERROR] No lifecycle mapping for type 'dude-application': using defaults

 

My META-INF/plexus.componenets.xml looks like this:

 

<components>

  <component>

    <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>

    <role-hint>eclipse-plugin</role-hint>

 
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</
implementation>

    <configuration>

      <phases>

        <process-resources>resources:resources</process-resources>

        <compile>pde:pde-compile</compile>

 
<process-test-resources>resources:testResources</process-test-resources>

        <test-compile>compiler:testCompile</test-compile>

        <test>surefire:test</test>

        <package>pde:pde-package</package>

        <install>install:install</install>

        <deploy>deploy:deploy</deploy>

      </phases>

    </configuration>

  </component>

</components>

 

If anyone can point me to a complete plugin example that defines its own
lifecycle I can probably work from there

 

Thanks,

Matthew

 

 


Re: help with custom lifecycle

Posted by Rafal Krzewski <Ra...@caltha.pl>.
Matthew Pryor wrote:

> <side-note>
> 
>             I suppose I could go down the path of trying to treat the
> Eclipse specific stuff as real dependencies and create artifacts for them
> and write a custom artifact handler that could read them from the Eclipse
> plugins folder, but I think that would be a lot of code and not be that much
> better than simply adding the jar files to the classpath before calling the
> AbstractCompilerMojo - private API issues aside
> 
> </side-note>

I think that your approach is valid. Its only disadvantage is that a 
"normal" (ie non eclipse plugin) maven project cannot use an eclipse 
plugin as a dependency, but it's a very marginal use case. One could 
extract the needed code to an utilty library project and depend on that.

If it saves you coding/testing effort, I would say go for it.

It's nice to hear that you are working on Maven 2 plugin for building 
eclipse specific artifacts. I think this funcitonality is missing from 
Maven 1 ecosystem.

I always felt that maven-eclipse-plugin should be a Maven plugin for 
building Eclipse plugins, features etc. and integrating Maven into 
Eclipse IDE should be done by writing a proper eclipse plugin (MavenIDE 
way), and not tinkering with Eclipse config files from a maven plugin.

Too much to do, to little time....

Rafal

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


RE: help with custom lifecycle

Posted by Matthew Pryor <mp...@agentissoftware.com>.
OK well I have read all that and am sadly no closer to understanding how to
create a custom packaging.

I want to support a packaging called 'eclipse-plugin'. I have all the code
working in terms of reading the addition to the classpath I want to make, I
just can't seem to be able to work out how to register my custom lifecycle.

AFAICT what I want to do is exactly the same as plexus:application, but so
far I don't seem to be able to convince m2 to pick up/read the content of
the components.xml in my plugin.

I can see the following in maven-core/META-INF/components.xml

    <!-- TODO: move to the plexus plugin -->
    <component>
      <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
      <role-hint>plexus-application</role-hint>
	
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</
implementation>
      <configuration>
        <!-- START SNIPPET: plexus-application-lifecycle -->
        <phases>
          <generate-resources>plexus:app</generate-resources>
          <package>plexus:bundle-application</package>
          <install>install:install</install>
          <deploy>deploy:deploy</deploy>
        </phases>
        <!-- END SNIPPET: plexus-application-lifecycle -->
      </configuration>
    </component>

But I can't seem to get my own variant of this notices. I have placed it
into the META-INF/components.xml file in my plugin, but when I run m2
aplha-3, I get the following error


[INFO] Deleting directory C:\proj\m2\workspace\m2-plugin-test\target
[ERROR] Nonexistent component:
org.apache.maven.lifecycle.mapping.LifecycleMappingeclipse-plugin
[ERROR] No lifecycle mapping for type 'eclipse-plugin': using defaults

Am I even on the right track?

Thanks,
Matthew

> -----Original Message-----
> From: Emmanuel Venisse [mailto:emmanuel@venisse.net]
> Sent: Monday, 4 July 2005 4:11 PM
> To: Maven Developers List
> Subject: Re: help with custom lifecycle
> 
> You can see some design docs there :
> http://docs.codehaus.org/display/MAVEN/Lifecycle
> 
> Emmanuel
> 
> 
> Matthew Pryor wrote:
> > I am trying to write/refine the mevenide Eclise PDE builder maven2
> plugin.
> >
> >
> >
> > In essence what this plugin needs to do is to read an XML file
> (plugin.xml)
> > and add a bunch of jar files to the classpath prior to compilation or
> > testing.
> >
> >
> >
> > I have all the latest source for m2 and am not 100% sure about the right
> > approach, but I think I will start with a custom lifecycle what will
> class a
> > slight modified compiler that add the 'private' Eclipse PDE dependencies
> >
> >
> >
> > <side-note>
> >
> >             I suppose I could go down the path of trying to treat the
> > Eclipse specific stuff as real dependencies and create artifacts for
> them
> > and write a custom artifact handler that could read them from the
> Eclipse
> > plugins folder, but I think that would be a lot of code and not be that
> much
> > better than simply adding the jar files to the classpath before calling
> the
> > AbstractCompilerMojo - private API issues aside
> >
> > </side-note>
> >
> >
> >
> > So my question is, after having read
> > http://maven.apache.org/maven2/lifecycle.html and attempting to follow
> it, I
> > get the following
> >
> >
> >
> > [INFO] Deleting directory C:\proj\m2\workspace\m2-plugin-test\target
> >
> > [ERROR] Nonexistent component:
> > org.apache.maven.lifecycle.mapping.LifecycleMappingeclipse-plugin
> >
> > [ERROR] No lifecycle mapping for type 'dude-application': using defaults
> >
> >
> >
> > My META-INF/plexus.componenets.xml looks like this:
> >
> >
> >
> > <components>
> >
> >   <component>
> >
> >     <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
> >
> >     <role-hint>eclipse-plugin</role-hint>
> >
> >
> >
> <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping
> </
> > implementation>
> >
> >     <configuration>
> >
> >       <phases>
> >
> >         <process-resources>resources:resources</process-resources>
> >
> >         <compile>pde:pde-compile</compile>
> >
> >
> > <process-test-resources>resources:testResources</process-test-resources>
> >
> >         <test-compile>compiler:testCompile</test-compile>
> >
> >         <test>surefire:test</test>
> >
> >         <package>pde:pde-package</package>
> >
> >         <install>install:install</install>
> >
> >         <deploy>deploy:deploy</deploy>
> >
> >       </phases>
> >
> >     </configuration>
> >
> >   </component>
> >
> > </components>
> >
> >
> >
> > If anyone can point me to a complete plugin example that defines its own
> > lifecycle I can probably work from there
> >
> >
> >
> > Thanks,
> >
> > Matthew
> >
> >
> >
> >
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: help with custom lifecycle

Posted by Emmanuel Venisse <em...@venisse.net>.
You can see some design docs there : 
http://docs.codehaus.org/display/MAVEN/Lifecycle

Emmanuel


Matthew Pryor wrote:
> I am trying to write/refine the mevenide Eclise PDE builder maven2 plugin.
> 
>  
> 
> In essence what this plugin needs to do is to read an XML file (plugin.xml)
> and add a bunch of jar files to the classpath prior to compilation or
> testing.
> 
>  
> 
> I have all the latest source for m2 and am not 100% sure about the right
> approach, but I think I will start with a custom lifecycle what will class a
> slight modified compiler that add the 'private' Eclipse PDE dependencies
> 
>  
> 
> <side-note>
> 
>             I suppose I could go down the path of trying to treat the
> Eclipse specific stuff as real dependencies and create artifacts for them
> and write a custom artifact handler that could read them from the Eclipse
> plugins folder, but I think that would be a lot of code and not be that much
> better than simply adding the jar files to the classpath before calling the
> AbstractCompilerMojo - private API issues aside
> 
> </side-note>
> 
>  
> 
> So my question is, after having read
> http://maven.apache.org/maven2/lifecycle.html and attempting to follow it, I
> get the following 
> 
>  
> 
> [INFO] Deleting directory C:\proj\m2\workspace\m2-plugin-test\target
> 
> [ERROR] Nonexistent component:
> org.apache.maven.lifecycle.mapping.LifecycleMappingeclipse-plugin
> 
> [ERROR] No lifecycle mapping for type 'dude-application': using defaults
> 
>  
> 
> My META-INF/plexus.componenets.xml looks like this:
> 
>  
> 
> <components>
> 
>   <component>
> 
>     <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
> 
>     <role-hint>eclipse-plugin</role-hint>
> 
>  
> <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</
> implementation>
> 
>     <configuration>
> 
>       <phases>
> 
>         <process-resources>resources:resources</process-resources>
> 
>         <compile>pde:pde-compile</compile>
> 
>  
> <process-test-resources>resources:testResources</process-test-resources>
> 
>         <test-compile>compiler:testCompile</test-compile>
> 
>         <test>surefire:test</test>
> 
>         <package>pde:pde-package</package>
> 
>         <install>install:install</install>
> 
>         <deploy>deploy:deploy</deploy>
> 
>       </phases>
> 
>     </configuration>
> 
>   </component>
> 
> </components>
> 
>  
> 
> If anyone can point me to a complete plugin example that defines its own
> lifecycle I can probably work from there
> 
>  
> 
> Thanks,
> 
> Matthew
> 
>  
> 
>  
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org