You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by S Ahmed <sa...@gmail.com> on 2012/04/18 17:53:06 UTC

variable to reference parent pom path?

I have a multi-maven project.

In a sub-module, I have a assembly.xml file (maven-assembly-plugin) that I
am using to build this module.  How can I reference the parent pom's path?

I want to create a folder in the root of the project that will contain some
configuration type files that I want to reference and copy over.

Re: variable to reference parent pom path?

Posted by Wayne Fay <wa...@gmail.com>.
> Since this module just has files in it, what kind of packaging type should
> it be?

In all likelihood, it should be a jar packaged project.

But if it is a parent, then you should leave the parent as a pom and
make a new module under the parent of type jar that holds these files.

Wayne

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


Re: variable to reference parent pom path?

Posted by S Ahmed <sa...@gmail.com>.
Since this module just has files in it, what kind of packaging type should
it be?

I'm getting b/c it is currently set as a packaging type of jar, what should
it be?

On Wed, Apr 18, 2012 at 12:34 PM, Wayne Fay <wa...@gmail.com> wrote:

> > In a sub-module, I have a assembly.xml file (maven-assembly-plugin) that
> I
> >> am using to build this module.  How can I reference the parent pom's
> path?
> >
> > You can do this using the expression "${project.basedir}/../.." or
> however
> > many directory levels up you need to go.
>
> Curtis is right about this but as he said later:
> > In an ideal world, you would not
> > include references upstream like this, but rather include everything
> needed
>
> IMO this is an anti-pattern in Maven. If someone gets the source code
> to build *just* this module, they will be unable to build it
> independent of anything else.
>
> Instead, you set up another module that exists solely to contain these
> configuration files and then pull it in as a dependency where you need
> them. Use dependency:unpack to put the files where you need them or
> the proper assembly configuration.
>
> Wayne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: variable to reference parent pom path?

Posted by Wayne Fay <wa...@gmail.com>.
> In a sub-module, I have a assembly.xml file (maven-assembly-plugin) that I
>> am using to build this module.  How can I reference the parent pom's path?
>
> You can do this using the expression "${project.basedir}/../.." or however
> many directory levels up you need to go.

Curtis is right about this but as he said later:
> In an ideal world, you would not
> include references upstream like this, but rather include everything needed

IMO this is an anti-pattern in Maven. If someone gets the source code
to build *just* this module, they will be unable to build it
independent of anything else.

Instead, you set up another module that exists solely to contain these
configuration files and then pull it in as a dependency where you need
them. Use dependency:unpack to put the files where you need them or
the proper assembly configuration.

Wayne

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


Re: variable to reference parent pom path?

Posted by Curtis Rueden <ct...@wisc.edu>.
Hi Ahmed,


In a sub-module, I have a assembly.xml file (maven-assembly-plugin) that I
> am using to build this module.  How can I reference the parent pom's path?
>

You can do this using the expression "${project.basedir}/../.." or however
many directory levels up you need to go.

Something like this:

<!-- Include documents in toplevel directory. -->
<fileSet>
  <directory>${project.basedir}/../..</directory>
  <outputDirectory>/</outputDirectory>
  <includes>
    <include>LICENSE*</include>
    <include>NOTICE*</include>
    <include>README*</include>
  </includes>
</fileSet>

Of course, this requires the toplevel aggregator/parent project to be
present as part of your working copy. In an ideal world, you would not
include references upstream like this, but rather include everything needed
for the assembly as part of the project in question. Then the build will
function even if only that specific project is available.

Regards,
Curtis


On Wed, Apr 18, 2012 at 10:53 AM, S Ahmed <sa...@gmail.com> wrote:

> I have a multi-maven project.
>
> In a sub-module, I have a assembly.xml file (maven-assembly-plugin) that I
> am using to build this module.  How can I reference the parent pom's path?
>
> I want to create a folder in the root of the project that will contain some
> configuration type files that I want to reference and copy over.
>