You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by E S <el...@gmail.com> on 2011/01/31 18:53:42 UTC

How to build plugin before top-level project uses it

I am new to maven. I have a top level project with several sub-projects
below it. I have recently created a plugin as a sub-project that will be
used by the top level project during the build (packaging phase most
likely). I am having trouble getting maven to build the plugin and install
it into the repository before the top level project needs it. It seems that
as soon as the top level project sees the requirement for the plugin, it
attempts to get it from the repository, which of course fails since it's not
there yet.  You can see it listed as the second item in the reactor order
just under the top level project. If I try adding the plugin as a
<dependency> of the top level POM, I get a cyclic reference error. I also
tried adding as a <dependency> to one of the subprojects, it still gives an
error stating that it's not in the repository.



Anyway, what’s the best way to go about doing this? If I build the plugin
separately, then run the entire build, it works fine. How can I get maven to
do something like that but without two separate builds?


Thanks,

Dave

Re: How to build plugin before top-level project uses it

Posted by E S <el...@gmail.com>.
Yes, using our shared repository would be another option. We would have to
maintain the plugin as if it were more like a 3rd party resource rather than
part of the product's source, but maybe that's the right way to think about.
Not sure, but if it works, I think that's fine. Thanks for the help.

On Mon, Jan 31, 2011 at 12:25 PM, Hilco Wijbenga
<hi...@gmail.com>wrote:

> On 31 January 2011 10:08, E S <el...@gmail.com> wrote:
> > That's certainly an option, but it doesn't work as well as I would like
> for
> > our build server or new developers getting their dev environments set up.
> We
> > could get around it using something like build script on top of maven,
> but I
> > would prefer a cleaner solution in which maven handles it automatically
> if
> > possible.
>
> How would any of this affect your build server or new developers? Just
> deploy the plugin once and it's available to everyone.
>
> You do have a place to deploy artifacts, right? If you don't then I
> would strongly suggest you set that up ASAP. (It's pretty simple.) I
> think you'll find that Maven doesn't scale very well without it so
> you're going to need it eventually anyway.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: How to build plugin before top-level project uses it

Posted by Hilco Wijbenga <hi...@gmail.com>.
On 31 January 2011 10:08, E S <el...@gmail.com> wrote:
> That's certainly an option, but it doesn't work as well as I would like for
> our build server or new developers getting their dev environments set up. We
> could get around it using something like build script on top of maven, but I
> would prefer a cleaner solution in which maven handles it automatically if
> possible.

How would any of this affect your build server or new developers? Just
deploy the plugin once and it's available to everyone.

You do have a place to deploy artifacts, right? If you don't then I
would strongly suggest you set that up ASAP. (It's pretty simple.) I
think you'll find that Maven doesn't scale very well without it so
you're going to need it eventually anyway.

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


Re: How to build plugin before top-level project uses it

Posted by E S <el...@gmail.com>.
That's certainly an option, but it doesn't work as well as I would like for
our build server or new developers getting their dev environments set up. We
could get around it using something like build script on top of maven, but I
would prefer a cleaner solution in which maven handles it automatically if
possible.

On Mon, Jan 31, 2011 at 12:00 PM, Hilco Wijbenga
<hi...@gmail.com>wrote:

> On 31 January 2011 09:53, E S <el...@gmail.com> wrote:
> > Anyway, what’s the best way to go about doing this? If I build the plugin
> > separately, then run the entire build, it works fine. How can I get maven
> to
> > do something like that but without two separate builds?
>
> Why don't you put it in a separate project? Run mvn install or mvn
> deploy once and your plugin is available to all of your projects. No
> need to build it again.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: How to build plugin before top-level project uses it

Posted by Hilco Wijbenga <hi...@gmail.com>.
On 31 January 2011 09:53, E S <el...@gmail.com> wrote:
> Anyway, what’s the best way to go about doing this? If I build the plugin
> separately, then run the entire build, it works fine. How can I get maven to
> do something like that but without two separate builds?

Why don't you put it in a separate project? Run mvn install or mvn
deploy once and your plugin is available to all of your projects. No
need to build it again.

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


Re: How to build plugin before top-level project uses it

Posted by E S <el...@gmail.com>.
Well, using a previous version of the plugin isn't an option since one
doesn't exist. As for using it in a separate reactor, are you saying you can
somehow have multiple reactors during a single build? Can you point me to
further information on that subject? Or did you just mean running a separate
build of the plugin first like Hilco suggested?

On Mon, Jan 31, 2011 at 12:11 PM, Stephen Connolly <
stephen.alan.connolly@gmail.com> wrote:

> you cannot use a plugin within the same reactor as the plugin is built
> from.
> this is usually solved in one of two ways:
> 1. use the immediately previous release of the plugin, so the reactor build
> version 1.1-SNAPSHOT but uses version 1.0
> 2. move the plugin to its own reactor
>
> the reason why this is required is that a plugin can change the build plan,
> and the build plan must be constructed before you start building
>
> - Stephen
>
> ---
> Sent from my Android phone, so random spelling mistakes, random nonsense
> words and other nonsense are a direct result of using swype to type on the
> screen
> On 31 Jan 2011 17:54, "E S" <el...@gmail.com> wrote:
>

Re: How to build plugin before top-level project uses it

Posted by Anders Hammar <an...@hammar.net>.
I thought this was possible with Maven 3.0, but not with Maven 2.x. Am I
wrong?

/Anders

On Mon, Jan 31, 2011 at 19:11, Stephen Connolly <
stephen.alan.connolly@gmail.com> wrote:

> you cannot use a plugin within the same reactor as the plugin is built
> from.
> this is usually solved in one of two ways:
> 1. use the immediately previous release of the plugin, so the reactor build
> version 1.1-SNAPSHOT but uses version 1.0
> 2. move the plugin to its own reactor
>
> the reason why this is required is that a plugin can change the build plan,
> and the build plan must be constructed before you start building
>
> - Stephen
>
> ---
> Sent from my Android phone, so random spelling mistakes, random nonsense
> words and other nonsense are a direct result of using swype to type on the
> screen
> On 31 Jan 2011 17:54, "E S" <el...@gmail.com> wrote:
>

Re: How to build plugin before top-level project uses it

Posted by Stephen Connolly <st...@gmail.com>.
you cannot use a plugin within the same reactor as the plugin is built from.
this is usually solved in one of two ways:
1. use the immediately previous release of the plugin, so the reactor build
version 1.1-SNAPSHOT but uses version 1.0
2. move the plugin to its own reactor

the reason why this is required is that a plugin can change the build plan,
and the build plan must be constructed before you start building

- Stephen

---
Sent from my Android phone, so random spelling mistakes, random nonsense
words and other nonsense are a direct result of using swype to type on the
screen
On 31 Jan 2011 17:54, "E S" <el...@gmail.com> wrote: