You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Brad Jarvinen <Br...@chordiant.com> on 2010/03/17 17:32:44 UTC

Using a Custom Lifecycle in a mojo and getting parameters to it

Hi,

 

For sample purposes, I've defined a custom lifecycle as follows:

 

<lifecycles> 

  <lifecycle> 

    <id>project-archetypes-lifecycle</id> 

    <phases> 

      <phase> 

        <id>validate</id> 

        <executions> 

          <execution> 

            <goals> 

              <goal> 

                org.apache.maven.plugins:maven-archetype-plugin:generate


              </goal> 

            </goals> 

            <configuration> 

              <artifactId>fred</artifactId> 

              <groupId>bob</groupId> 

              <interactiveMode>false</interactiveMode> 

            </configuration> 

          </execution> 

        </executions> 

      </phase> 

    </phases> 

  </lifecycle> 

</lifecycles>

 

And in my Maven plug-in, I've included an annotation to execute the
lifecycle before my mojo executes:

 

* @execute lifecycle="project-archetypes-lifecycle" phase="validate"

 

 

But when I run my plug-in, I get the following error:

 

[WARNING] Property artifactId is missing. Add -DartifactId=someValue

 

It'll only work if I pass -DartifactId to my mojo from the command line.
It seems that configuration element in the lifecycle definition is
ignored for artifactId.  But yet, the interfaceMode=false seems to work.

 

Any ideas how I can pass variable data into the custom lifecycle
definition when I invoke it from another mojo?

 

Thanks,

Brad

 

 

 

The information transmitted herewith is sensitive      information of Chordiant Software or its customers and is intended only for use to the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon, this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.
The information transmitted herewith is sensitive      information of Chordiant Software or its customers and is intended only for use to the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon, this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.

Re: Using a Custom Lifecycle in a mojo and getting parameters to it

Posted by Justin Edelson <ju...@gmail.com>.
I would just write a standalone mojo and invoke maven in a forked
process as needed.

Justin

On Mar 17, 2010, at 8:02 PM, Brad Jarvinen
<Br...@chordiant.com> wrote:

> Another possibility is that I'm using the wrong tool for the job.
> So I should explain what I'm trying to do.
>
> From my mojo, I'm trying to invoke other mojos and goals. My mojo
> invokes many "sub" goals, i.e.
> - generate 4 projects with archetype:generate
> - add some files to each of the projects
> - change some pom.xml settings
>
> A custom lifecycle seems to allow me to invoke the
> archetype:generate 4 times to create 4 projects.  I then could
> invoke other goals to populate files into those projects.  Would a
> custom archetype be better?  Or would some other method I'm unaware
> of be better?
>
> Any suggestions extremely welcome.
>
>
>
>
> The information transmitted herewith is sensitive      information
> of Chordiant Software or its customers and is intended only for use
> to the individual or entity to which it is addressed. If the reader
> of this message is not the intended recipient, you are hereby
> notified that any review, retransmission, dissemination,
> distribution, copying or other use of, or taking of any action in
> reliance upon, this information is strictly prohibited. If you have
> received this communication in error, please contact the sender and
> delete the material from your computer.

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


RE: Using a Custom Lifecycle in a mojo and getting parameters to it

Posted by Brad Jarvinen <Br...@chordiant.com>.
Another possibility is that I'm using the wrong tool for the job.  So I should explain what I'm trying to do.

From my mojo, I'm trying to invoke other mojos and goals. My mojo invokes many "sub" goals, i.e.
- generate 4 projects with archetype:generate
- add some files to each of the projects
- change some pom.xml settings

A custom lifecycle seems to allow me to invoke the archetype:generate 4 times to create 4 projects.  I then could invoke other goals to populate files into those projects.  Would a custom archetype be better?  Or would some other method I'm unaware of be better?

Any suggestions extremely welcome.




The information transmitted herewith is sensitive      information of Chordiant Software or its customers and is intended only for use to the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon, this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.

Re: Using a Custom Lifecycle in a mojo and getting parameters to it

Posted by Wayne Fay <wa...@gmail.com>.
No hides have been chapped; this happens regularly. Usually it is a
mistake but sometimes (especially when the emails are spaced hours
apart, as yours were) it is someone who has a REALLY URGENT (to them)
PROBLEM that needs to be RESOLVED RIGHT NOW and that's simply not how
this list works.

You can always check if an email "got through" by checking Nabble.com,
Markmail.org, mail-archives.apache.org, www.mail-archive.com, etc.

I have almost zero experience with custom lifecycles at this point.
Hopefully someone else will reply with more useful information.

Wayne

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


RE: Using a Custom Lifecycle in a mojo and getting parameters to it

Posted by Brad Jarvinen <Br...@chordiant.com>.
Sorry to have chapped some people's hides because of a single duplicate request; it was purely unintentional and a result of my company's overly exuberant spam filters preventing me from knowing the first post went through.  Please don't let that prevent someone from responding with a greatly appreciated and more technically helpful response.

The information transmitted herewith is sensitive      information of Chordiant Software or its customers and is intended only for use to the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon, this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.

Re: Using a Custom Lifecycle in a mojo and getting parameters to it

Posted by Wayne Fay <wa...@gmail.com>.
Its rude to send an email more than once to a list like this without
waiting a couple days in between. If/when someone has a response, they
will reply.

Wayne

On Wed, Mar 17, 2010 at 11:32 AM, Brad Jarvinen
<Br...@chordiant.com> wrote:
> Hi,
>
>
>
> For sample purposes, I've defined a custom lifecycle as follows:
>

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