You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Oscar Picasso <os...@gmail.com> on 2007/07/31 05:13:12 UTC

Parent POM, properties and scm problem

Hi,

In the parent POM I have the following:
[...]
  <properties>
    <scmConnection>
http://localhost/repos/repo/${groupId}/${artifactId}/trunk</scmConnection>
  </properties>


  <scm>
    <connection>${scmConnection}</connection>
    <developerConnection>${scmConnection}</developerConnection>
  </scm>
[...]

The child POM has nothing expect mandatory elements and the reference to the
parent POM. Both the child and the parent are snapshots. The parent POM has
been deployed to the remote repository.

When I run mvn help:effective-pom on the child project, I get:
[...]
  <scm>
    <connection>http://localhost/repos/repo/com.opicasso/Child/trunk/Child
</connection>
    <developerConnection>
http://localhost/repos/repo/com.opicasso/Child/trunk/Child
</developerConnection>
  </scm>
[..]

I would have expected:
[...]
  <scm>
    <connection>http://localhost/repos/repo/com.opicasso/Child/trunk
</connection>
    <developerConnection>
http://localhost/repos/repo/com.opicasso/Child/trunk</developerConnection>
  </scm>
[..]

Why does maven happen the child artifactId to the connections? Does maven
merge the parent scm connections with the children ones ? But in the current
case the child has no scm connections defined in its pom.

How to get rid of this extra artifactId?

Thanks

Oscar

Re: Parent POM, properties and scm problem

Posted by Eric Redmond <er...@gmail.com>.
Might I suggest for the time being, to download and install the
maven-pom-plugin (
http://svn.apache.org/repos/asf/maven/sandbox/trunk/plugins/maven-pom-plugin/)
and manually manage the scm fields in the projects. I know it's a hack, but
non-standard layouts tend to produce non-standard solutions. Welcome to
convention over configuration :)

-- 
Eric Redmond
http://blog.propellors.net

On 8/6/07, Jörg Schaible <Jo...@elsag-solutions.com> wrote:
>
> Oscar Picasso wrote on Wednesday, August 01, 2007 7:31 PM:
>
> > The current Maven behaviour is fine for multimodule projects.
> >
> > However I am trying to write a organizational POM that all my projets
> > would inherited and wanted to avoid duplication of the scm section.
> >
> > So in case of independent projects it does not make sense to put all
> > them inside the same trunk.
> >
> > I guess currently I cannot avoid this duplication.
>
> Not really, and there's a simple reason: You cannot assume that everyone
> keeps his "organizational POM" in the root of all the projects. Our
> "organizational POM" has SCM URL entries that are used to release the
> "organizational POM" itself. It does not even make sense to inherit them.
>
> However, you may use properties to define the SCM URLs as we do:
>
> <scm>
>     <connection>scm|svn|${my.svn.root}${my.svn.tagBase}/trunk</connection>
>     <developerConnection>scm|svn|${my.svn.root}${my.svn.tagBase
> }/trunk</developerConnection>
>     <url>${my.svn.view}${my.svn.tagBase}/trunk</url>
> </scm>
>
> while "my.svn.root" and "my.svn.view" are properties that are defined in
> the "organizational POM" and "my.svn.tagBase" is defined in the POM of the
> project root (in case of a multi-module project). But keep in mind, that the
> release-plugin will rewrite the URLs after the first release, so there are
> no properties in the URL anymore anyway. So the whole definition is only
> useful as template for new POMs.
>
> - Jörg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

RE: Parent POM, properties and scm problem

Posted by Jörg Schaible <Jo...@Elsag-Solutions.com>.
Oscar Picasso wrote on Wednesday, August 01, 2007 7:31 PM:

> The current Maven behaviour is fine for multimodule projects.
> 
> However I am trying to write a organizational POM that all my projets
> would inherited and wanted to avoid duplication of the scm section.
> 
> So in case of independent projects it does not make sense to put all
> them inside the same trunk.
> 
> I guess currently I cannot avoid this duplication.

Not really, and there's a simple reason: You cannot assume that everyone keeps his "organizational POM" in the root of all the projects. Our "organizational POM" has SCM URL entries that are used to release the "organizational POM" itself. It does not even make sense to inherit them.

However, you may use properties to define the SCM URLs as we do:

<scm>
    <connection>scm|svn|${my.svn.root}${my.svn.tagBase}/trunk</connection>
    <developerConnection>scm|svn|${my.svn.root}${my.svn.tagBase}/trunk</developerConnection>
    <url>${my.svn.view}${my.svn.tagBase}/trunk</url>
</scm>

while "my.svn.root" and "my.svn.view" are properties that are defined in the "organizational POM" and "my.svn.tagBase" is defined in the POM of the project root (in case of a multi-module project). But keep in mind, that the release-plugin will rewrite the URLs after the first release, so there are no properties in the URL anymore anyway. So the whole definition is only useful as template for new POMs.

- Jörg

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


Re: Parent POM, properties and scm problem

Posted by Oscar Picasso <os...@gmail.com>.
That's exactly what I am doing.

And it works fine except for the problem that I mention in this thread of
the project artifactId being added to some urls like the scmConnection.

On 8/1/07, Bryan Loofbourrow <br...@islandbeast.com> wrote:
>
> I'm wondering if the following would work:
>
> - Make your organizational pom project. Don't define any <module> entries
> in
> it.
> - Have all of your projects depend on it as a parent
> - Build and install your organizational pom to a central repository
> accessible to all of your projects.
>
> I'm thinking that you can then independently build and deploy your
> organizational pom by itself, and have your projects use it, from the
> repository, as a parent for definition purposes, though not build
> purposes.
>
> I'd be interested to know whether this works. It seems useful.
>
> -- Bryan
>
> -----Original Message-----
> From: Oscar Picasso [mailto:oscarpicasso@gmail.com]
> Sent: Wednesday, August 01, 2007 10:31 AM
> To: Maven Users List
> Subject: Re: Parent POM, properties and scm problem
>
> The current Maven behaviour is fine for multimodule projects.
>
> However I am trying to write a organizational POM that all my projets
> would
> inherited and wanted to avoid duplication of the scm section.
>
> So in case of independent projects it does not make sense to put all them
> inside the same trunk.
>
> I guess currently I cannot avoid this duplication.
>
> On 7/31/07, Eric Redmond <er...@gmail.com> wrote:
> >
> > Maven does this so that child module's scm can be defined once in the
> > parent.
> >
> > <scm>
> >   <connection>scm:svn:https://url/project/trunk
> > </scm>
> >
> > <modules>
> >   <module>Child
> >
> > Then the Child module's scm url is automatically set as:
> >
> > <scm>
> >   <connection>scm:svn:https://url/project/trunk/Child
> > </scm>
> >
> > Which is the convention for a multi-module project.
> >
> > If your "Child" project has to be seperate, with it's own trunk, etc. I
> > would suggest (if svn) using svn:externals to access the child under the
> > parent project. Since it ownly appends the name on a multi-module
> project,
> > I'm trying to figure out how you locally check out your project...
> perhaps
> > create a "trunks"-style setup in your version control would be best?
> >
> > Eric
> >
> > On 7/30/07, Oscar Picasso <os...@gmail.com> wrote:
> > >
> > > I have also noticed the same behavior with the project url, the sit
> url
> > > and
> > > the scm url even if in the effective the corresponding properties are
> > > correct (without the artifactId appended).
> > >
> > > On 7/30/07, Oscar Picasso <os...@gmail.com> wrote:
> > > >
> > > > Hi,
> > > >
> > > > In the parent POM I have the following:
> > > > [...]
> > > >   <properties>
> > > >     <scmConnection>
> > > http://localhost/repos/repo/${groupId}/${artifactId}/trunk
> > > > <http://localhost/repos/repo/$%7BgroupId%7D/$%7BartifactId%7D/trunk>
> > > > </scmConnection>
> > > >   </properties>
> > > >
> > > >
> > > >   <scm>
> > > >     <connection>${scmConnection}</connection>
> > > >     <developerConnection>${scmConnection}</developerConnection>
> > > >   </scm>
> > > > [...]
> > > >
> > > > The child POM has nothing expect mandatory elements and the
> reference
> > to
> > > > the parent POM. Both the child and the parent are snapshots. The
> > parent
> > > POM
> > > > has been deployed to the remote repository.
> > > >
> > > > When I run mvn help:effective-pom on the child project, I get:
> > > > [...]
> > > >   <scm>
> > > >     <connection>
> > > http://localhost/repos/repo/com.opicasso/Child/trunk/Child
> > > > </connection>
> > > >     <developerConnection>
> > > > http://localhost/repos/repo/com.opicasso/Child/trunk/Child
> > > > </developerConnection>
> > > >   </scm>
> > > > [..]
> > > >
> > > > I would have expected:
> > > > [...]
> > > >   <scm>
> > > >     <connection>http://localhost/repos/repo/com.opicasso/Child/trunk
> > > > </connection>
> > > >     <developerConnection>
> > > > http://localhost/repos/repo/com.opicasso/Child/trunk
> > > </developerConnection>
> > > >   </scm>
> > > > [..]
> > > >
> > > > Why does maven happen the child artifactId to the connections? Does
> > > maven
> > > > merge the parent scm connections with the children ones ? But in the
> > > current
> > > > case the child has no scm connections defined in its pom.
> > > >
> > > > How to get rid of this extra artifactId?
> > > >
> > > > Thanks
> > > >
> > > > Oscar
> > > >
> > > >
> > > >
> > >
> >
> >
> >
> > --
> > Eric Redmond
> > http://blog.propellors.net
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

RE: Parent POM, properties and scm problem

Posted by Bryan Loofbourrow <br...@islandbeast.com>.
I'm wondering if the following would work:

- Make your organizational pom project. Don't define any <module> entries in
it.  
- Have all of your projects depend on it as a parent
- Build and install your organizational pom to a central repository
accessible to all of your projects.

I'm thinking that you can then independently build and deploy your
organizational pom by itself, and have your projects use it, from the
repository, as a parent for definition purposes, though not build purposes.

I'd be interested to know whether this works. It seems useful.

-- Bryan

-----Original Message-----
From: Oscar Picasso [mailto:oscarpicasso@gmail.com] 
Sent: Wednesday, August 01, 2007 10:31 AM
To: Maven Users List
Subject: Re: Parent POM, properties and scm problem

The current Maven behaviour is fine for multimodule projects.

However I am trying to write a organizational POM that all my projets would
inherited and wanted to avoid duplication of the scm section.

So in case of independent projects it does not make sense to put all them
inside the same trunk.

I guess currently I cannot avoid this duplication.

On 7/31/07, Eric Redmond <er...@gmail.com> wrote:
>
> Maven does this so that child module's scm can be defined once in the
> parent.
>
> <scm>
>   <connection>scm:svn:https://url/project/trunk
> </scm>
>
> <modules>
>   <module>Child
>
> Then the Child module's scm url is automatically set as:
>
> <scm>
>   <connection>scm:svn:https://url/project/trunk/Child
> </scm>
>
> Which is the convention for a multi-module project.
>
> If your "Child" project has to be seperate, with it's own trunk, etc. I
> would suggest (if svn) using svn:externals to access the child under the
> parent project. Since it ownly appends the name on a multi-module project,
> I'm trying to figure out how you locally check out your project... perhaps
> create a "trunks"-style setup in your version control would be best?
>
> Eric
>
> On 7/30/07, Oscar Picasso <os...@gmail.com> wrote:
> >
> > I have also noticed the same behavior with the project url, the sit url
> > and
> > the scm url even if in the effective the corresponding properties are
> > correct (without the artifactId appended).
> >
> > On 7/30/07, Oscar Picasso <os...@gmail.com> wrote:
> > >
> > > Hi,
> > >
> > > In the parent POM I have the following:
> > > [...]
> > >   <properties>
> > >     <scmConnection>
> > http://localhost/repos/repo/${groupId}/${artifactId}/trunk
> > > <http://localhost/repos/repo/$%7BgroupId%7D/$%7BartifactId%7D/trunk>
> > > </scmConnection>
> > >   </properties>
> > >
> > >
> > >   <scm>
> > >     <connection>${scmConnection}</connection>
> > >     <developerConnection>${scmConnection}</developerConnection>
> > >   </scm>
> > > [...]
> > >
> > > The child POM has nothing expect mandatory elements and the reference
> to
> > > the parent POM. Both the child and the parent are snapshots. The
> parent
> > POM
> > > has been deployed to the remote repository.
> > >
> > > When I run mvn help:effective-pom on the child project, I get:
> > > [...]
> > >   <scm>
> > >     <connection>
> > http://localhost/repos/repo/com.opicasso/Child/trunk/Child
> > > </connection>
> > >     <developerConnection>
> > > http://localhost/repos/repo/com.opicasso/Child/trunk/Child
> > > </developerConnection>
> > >   </scm>
> > > [..]
> > >
> > > I would have expected:
> > > [...]
> > >   <scm>
> > >     <connection>http://localhost/repos/repo/com.opicasso/Child/trunk
> > > </connection>
> > >     <developerConnection>
> > > http://localhost/repos/repo/com.opicasso/Child/trunk
> > </developerConnection>
> > >   </scm>
> > > [..]
> > >
> > > Why does maven happen the child artifactId to the connections? Does
> > maven
> > > merge the parent scm connections with the children ones ? But in the
> > current
> > > case the child has no scm connections defined in its pom.
> > >
> > > How to get rid of this extra artifactId?
> > >
> > > Thanks
> > >
> > > Oscar
> > >
> > >
> > >
> >
>
>
>
> --
> Eric Redmond
> http://blog.propellors.net
>


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


Re: Parent POM, properties and scm problem

Posted by Oscar Picasso <os...@gmail.com>.
The current Maven behaviour is fine for multimodule projects.

However I am trying to write a organizational POM that all my projets would
inherited and wanted to avoid duplication of the scm section.

So in case of independent projects it does not make sense to put all them
inside the same trunk.

I guess currently I cannot avoid this duplication.

On 7/31/07, Eric Redmond <er...@gmail.com> wrote:
>
> Maven does this so that child module's scm can be defined once in the
> parent.
>
> <scm>
>   <connection>scm:svn:https://url/project/trunk
> </scm>
>
> <modules>
>   <module>Child
>
> Then the Child module's scm url is automatically set as:
>
> <scm>
>   <connection>scm:svn:https://url/project/trunk/Child
> </scm>
>
> Which is the convention for a multi-module project.
>
> If your "Child" project has to be seperate, with it's own trunk, etc. I
> would suggest (if svn) using svn:externals to access the child under the
> parent project. Since it ownly appends the name on a multi-module project,
> I'm trying to figure out how you locally check out your project... perhaps
> create a "trunks"-style setup in your version control would be best?
>
> Eric
>
> On 7/30/07, Oscar Picasso <os...@gmail.com> wrote:
> >
> > I have also noticed the same behavior with the project url, the sit url
> > and
> > the scm url even if in the effective the corresponding properties are
> > correct (without the artifactId appended).
> >
> > On 7/30/07, Oscar Picasso <os...@gmail.com> wrote:
> > >
> > > Hi,
> > >
> > > In the parent POM I have the following:
> > > [...]
> > >   <properties>
> > >     <scmConnection>
> > http://localhost/repos/repo/${groupId}/${artifactId}/trunk
> > > <http://localhost/repos/repo/$%7BgroupId%7D/$%7BartifactId%7D/trunk>
> > > </scmConnection>
> > >   </properties>
> > >
> > >
> > >   <scm>
> > >     <connection>${scmConnection}</connection>
> > >     <developerConnection>${scmConnection}</developerConnection>
> > >   </scm>
> > > [...]
> > >
> > > The child POM has nothing expect mandatory elements and the reference
> to
> > > the parent POM. Both the child and the parent are snapshots. The
> parent
> > POM
> > > has been deployed to the remote repository.
> > >
> > > When I run mvn help:effective-pom on the child project, I get:
> > > [...]
> > >   <scm>
> > >     <connection>
> > http://localhost/repos/repo/com.opicasso/Child/trunk/Child
> > > </connection>
> > >     <developerConnection>
> > > http://localhost/repos/repo/com.opicasso/Child/trunk/Child
> > > </developerConnection>
> > >   </scm>
> > > [..]
> > >
> > > I would have expected:
> > > [...]
> > >   <scm>
> > >     <connection>http://localhost/repos/repo/com.opicasso/Child/trunk
> > > </connection>
> > >     <developerConnection>
> > > http://localhost/repos/repo/com.opicasso/Child/trunk
> > </developerConnection>
> > >   </scm>
> > > [..]
> > >
> > > Why does maven happen the child artifactId to the connections? Does
> > maven
> > > merge the parent scm connections with the children ones ? But in the
> > current
> > > case the child has no scm connections defined in its pom.
> > >
> > > How to get rid of this extra artifactId?
> > >
> > > Thanks
> > >
> > > Oscar
> > >
> > >
> > >
> >
>
>
>
> --
> Eric Redmond
> http://blog.propellors.net
>

Re: Parent POM, properties and scm problem

Posted by Eric Redmond <er...@gmail.com>.
Maven does this so that child module's scm can be defined once in the
parent.

<scm>
  <connection>scm:svn:https://url/project/trunk
</scm>

<modules>
  <module>Child

Then the Child module's scm url is automatically set as:

<scm>
  <connection>scm:svn:https://url/project/trunk/Child
</scm>

Which is the convention for a multi-module project.

If your "Child" project has to be seperate, with it's own trunk, etc. I
would suggest (if svn) using svn:externals to access the child under the
parent project. Since it ownly appends the name on a multi-module project,
I'm trying to figure out how you locally check out your project... perhaps
create a "trunks"-style setup in your version control would be best?

Eric

On 7/30/07, Oscar Picasso <os...@gmail.com> wrote:
>
> I have also noticed the same behavior with the project url, the sit url
> and
> the scm url even if in the effective the corresponding properties are
> correct (without the artifactId appended).
>
> On 7/30/07, Oscar Picasso <os...@gmail.com> wrote:
> >
> > Hi,
> >
> > In the parent POM I have the following:
> > [...]
> >   <properties>
> >     <scmConnection>
> http://localhost/repos/repo/${groupId}/${artifactId}/trunk
> > <http://localhost/repos/repo/$%7BgroupId%7D/$%7BartifactId%7D/trunk>
> > </scmConnection>
> >   </properties>
> >
> >
> >   <scm>
> >     <connection>${scmConnection}</connection>
> >     <developerConnection>${scmConnection}</developerConnection>
> >   </scm>
> > [...]
> >
> > The child POM has nothing expect mandatory elements and the reference to
> > the parent POM. Both the child and the parent are snapshots. The parent
> POM
> > has been deployed to the remote repository.
> >
> > When I run mvn help:effective-pom on the child project, I get:
> > [...]
> >   <scm>
> >     <connection>
> http://localhost/repos/repo/com.opicasso/Child/trunk/Child
> > </connection>
> >     <developerConnection>
> > http://localhost/repos/repo/com.opicasso/Child/trunk/Child
> > </developerConnection>
> >   </scm>
> > [..]
> >
> > I would have expected:
> > [...]
> >   <scm>
> >     <connection>http://localhost/repos/repo/com.opicasso/Child/trunk
> > </connection>
> >     <developerConnection>
> > http://localhost/repos/repo/com.opicasso/Child/trunk
> </developerConnection>
> >   </scm>
> > [..]
> >
> > Why does maven happen the child artifactId to the connections? Does
> maven
> > merge the parent scm connections with the children ones ? But in the
> current
> > case the child has no scm connections defined in its pom.
> >
> > How to get rid of this extra artifactId?
> >
> > Thanks
> >
> > Oscar
> >
> >
> >
>



-- 
Eric Redmond
http://blog.propellors.net

Re: Parent POM, properties and scm problem

Posted by Oscar Picasso <os...@gmail.com>.
I have also noticed the same behavior with the project url, the sit url and
the scm url even if in the effective the corresponding properties are
correct (without the artifactId appended).

On 7/30/07, Oscar Picasso <os...@gmail.com> wrote:
>
> Hi,
>
> In the parent POM I have the following:
> [...]
>   <properties>
>     <scmConnection>http://localhost/repos/repo/${groupId}/${artifactId}/trunk
> <http://localhost/repos/repo/$%7BgroupId%7D/$%7BartifactId%7D/trunk>
> </scmConnection>
>   </properties>
>
>
>   <scm>
>     <connection>${scmConnection}</connection>
>     <developerConnection>${scmConnection}</developerConnection>
>   </scm>
> [...]
>
> The child POM has nothing expect mandatory elements and the reference to
> the parent POM. Both the child and the parent are snapshots. The parent POM
> has been deployed to the remote repository.
>
> When I run mvn help:effective-pom on the child project, I get:
> [...]
>   <scm>
>     <connection>http://localhost/repos/repo/com.opicasso/Child/trunk/Child
> </connection>
>     <developerConnection>
> http://localhost/repos/repo/com.opicasso/Child/trunk/Child
> </developerConnection>
>   </scm>
> [..]
>
> I would have expected:
> [...]
>   <scm>
>     <connection>http://localhost/repos/repo/com.opicasso/Child/trunk
> </connection>
>     <developerConnection>
> http://localhost/repos/repo/com.opicasso/Child/trunk</developerConnection>
>   </scm>
> [..]
>
> Why does maven happen the child artifactId to the connections? Does maven
> merge the parent scm connections with the children ones ? But in the current
> case the child has no scm connections defined in its pom.
>
> How to get rid of this extra artifactId?
>
> Thanks
>
> Oscar
>
>
>