You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@continuum.apache.org by Simon Kitching <sk...@gfg-group.com> on 2006/04/20 02:29:02 UTC

SVN paths when adding an m2 pom with module declarations

Hi,

I've got a pom with this:
  <scm>
    <connection>scm:svn:http://.../trunk</connection>
  </scm>

  <modules>
    <module>common/core</module>
    <module>common/business</module>
    <module>transactions/transaction-server</module>
    <module>transactions/payment-server</module>
    <module>transactions/billing-server</module>
    <module>transactions/im_handset_sim</module>
    <module>management</module>
  </modules>

I specified the URL to this pom in continuum 20040414. Continuum correctly
added each of the child modules as a separate "project". However the SVN
urls are not set right. For example, the "core" module thinks its svn path
is:
  http://.../trunk/common-core
when it should be using
  http://.../trunk/common/core

In other words, it's appending the child pom artifactId to the base scm url,
when it should be using the module path that led to that pom.

Is there any way to tell it what the correct URL is? I noticed that in
continuum 1.0.2, I could click on the project name then use the "edit"
button to modify the project details. I can't find how to do this in
20040414...any hints?

Regards,

Simon



RE: SVN paths when adding an m2 pom with module declarations

Posted by Simon Kitching <sk...@gfg-group.com>.
 



  _____  

From: Simon Kitching [mailto:skitching@gfg-group.com] 

> 
> I specified the URL to this pom in continuum 20040414. Continuum correctly
> added each of the child modules as a separate "project". However the SVN
> urls are not set right. For example, the "core" module thinks its svn path
> is:
> http://.../trunk/common-core
> when it should be using
> http://.../trunk/common/core

It's a problem in maven api.
maven use artifactId and not module name for path resolution. 

 [snip] 

I will therefore file a bug against maven.  
 
Hmm..on further thought, this approach just won't work. There's no reliable
way to deduce the scm url for a project from (scn url for parent) + (path
from project to parent). Example:
 "scm:svn:http://foo.example/dir1"  and "../dir1/pom.xml"
 isn't enough to realise that the project in question can be found at:
  scm:svn:http://foo.example/widget

However it seems to me that the safest option for Continuum would be to
calculate the scm url based on the scm url of the originally imported
module, and the module path to each project .
 
So the approach above would seem to be the only reliable one. The existing
maven approach of appending artifactId to the parent pom's scm url is really
just a heuristic (a guess that will work for some subset of valid
configurations only).
 
Alternately, an <scm> block in each pom.xml is required.
 
This maven jira entry has some related info:
http://jira.codehaus.org/browse/MNG-1031
 
Regards,
 
Simon


RE: SVN paths when adding an m2 pom with module declarations

Posted by Simon Kitching <sk...@gfg-group.com>.
Hi Emmanuel,


  _____  

From: Emmanuel Venisse [mailto:emmanuel@venisse.net] 
Sent: Thursday, April 20, 2006 7:57 PM
To: continuum-users@maven.apache.org
Subject: Re: SVN paths when adding an m2 pom with module declarations




Simon Kitching a écrit :
> Hi,
> 
> I've got a pom with this:
> 
> scm:svn:http://.../trunk
> 
> 
> 
> common/core
> common/business
> transactions/transaction-server
> transactions/payment-server
> transactions/billing-server
> transactions/im_handset_sim
> management
> 
> 
> I specified the URL to this pom in continuum 20040414. Continuum correctly
> added each of the child modules as a separate "project". However the SVN
> urls are not set right. For example, the "core" module thinks its svn path
> is:
> http://.../trunk/common-core
> when it should be using
> http://.../trunk/common/core

It's a problem in maven api.
maven use artifactId and not module name for path resolution. 
 
Do you have set the parent relativePath in your modules if it isn't
../pom.xml (the default value) 
 
Yes, each of the modules has:
<parent> 

 <artifactId>system</artifactId>

<groupId>com.gfggroup.mobile</groupId>

<version>1.0-SNAPSHOT</version>

<relativePath>../../pom.xml</relativePath>

</parent >  

And yes, it makes sense that given the scm url of a parent pom, and the
relative path from project X to its parent, the scm url of project X can be
determined. But unfortunately it definitely isn't working that way for
continuum at the moment.

I tried your suggestion of "mvn help:effective-pom", and maven is definitely
not getting it right:

  <scm>
 
<connection>scm:svn:http://gfgdev4/svn/peregrine/trunk/transactions-txcore</
connection>
    <url>http://gfgdev4/svn/peregrine/transactions-txcore</url>
  </scm>

I will therefore file a bug against maven. 

However it seems to me that the safest option for Continuum would be to
calculate the scm url based on the scm url of the originally imported
module, and the module path to each project. After all, a pom can have
module declarations pointing to projects that have no parent. In this
situation, continuum has enough information to compute the scm urls (because
it's walking from the original pom down to the declared modules) even though
it's not possible to deduce the scm url by looking at each individual
project.


> 
> In other words, it's appending the child pom artifactId to the base scm
url,
> when it should be using the module path that led to that pom.
> 
> Is there any way to tell it what the correct URL is? I noticed that in
> continuum 1.0.2, I could click on the project name then use the "edit"
> button to modify the project details. I can't find how to do this in
> 20040414...any hints?

If the relativePath doesn't solve your pb, you should define the in your
modules. 

Yes, I guess I could put an <scm> block in every pom in the tree, and will
do so now. 

Many thanks for your reply.

Regards,

Simon


Re: SVN paths when adding an m2 pom with module declarations

Posted by Emmanuel Venisse <em...@venisse.net>.
Simon Kitching a écrit :
> Hi,
> 
> I've got a pom with this:
>   <scm>
>     <connection>scm:svn:http://.../trunk</connection>
>   </scm>
> 
>   <modules>
>     <module>common/core</module>
>     <module>common/business</module>
>     <module>transactions/transaction-server</module>
>     <module>transactions/payment-server</module>
>     <module>transactions/billing-server</module>
>     <module>transactions/im_handset_sim</module>
>     <module>management</module>
>   </modules>
> 
> I specified the URL to this pom in continuum 20040414. Continuum correctly
> added each of the child modules as a separate "project". However the SVN
> urls are not set right. For example, the "core" module thinks its svn path
> is:
>   http://.../trunk/common-core
> when it should be using
>   http://.../trunk/common/core

It's a problem in maven api.
maven use artifactId and not module name for path resolution.
Do you have set the parent relativePath in your modules if it isn't ../pom.xml (the default value)

> 
> In other words, it's appending the child pom artifactId to the base scm url,
> when it should be using the module path that led to that pom.
> 
> Is there any way to tell it what the correct URL is? I noticed that in
> continuum 1.0.2, I could click on the project name then use the "edit"
> button to modify the project details. I can't find how to do this in
> 20040414...any hints?

If the relativePath doesn't solve your pb, you should define the <scm> in your modules.
Another workaround (it's my preference) is to create intermediate pom in your subdirectories like this:

pom.xml               <== will include only modules common, transactions, management
common                <== will include only modules core, business
   core
     pom.xml
   business
     pom.xml
transactions          <= will include only modules transaction-server, payment-server,...
   pom.xml
   transaction-server
     pom.xml
...

With this architecture, you'll define <scm> only in root parent pom and all scm path will be 
relsolve correctly.
You can check resolved path of scm url with "mvn help:effective-pom"

Emmanuel