You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Phillip Hellewell <ss...@gmail.com> on 2010/10/19 19:47:52 UTC

scm connection in parent pom

Hi all,

Does it make sense and will it work to define the scm connection in a
parent pom if all my projects follow the same layout in SVN?

i.e., <connection>scm:svn:http://mysvnrep.com/svn/projects/${artifactId}/trunk</connection>

Also, is there a common way to let each developer decide which
protocol they want to use, e.g., svn+ssh:// instead of http://.

Thanks,
Phillip

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


Re: scm connection in parent pom

Posted by Jörg Schaible <jo...@gmx.de>.
Hi Phillip,

Phillip Hellewell wrote:

> On Tue, Oct 19, 2010 at 11:47 AM, Phillip Hellewell <ss...@gmail.com>
> wrote:
>>
>> Also, is there a common way to let each developer decide which
>> protocol they want to use, e.g., svn+ssh:// instead of http://.
> 
> Of course, the big problem with svn+ssh:// is that you have to have
> the username in the URL too.  Is there a varaible, e.g., ${username},
> that I can shove in there?

${user.name}

However, the release plugin will rewrite the SCM URLs during release and 
reolve all properties with their real values - unfortunately. Otherwise you 
could also use a property for the protocol defined in the settings of each 
developer.

- Jörg


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


Re: scm connection in parent pom

Posted by Phillip Hellewell <ss...@gmail.com>.
On Tue, Oct 19, 2010 at 11:47 AM, Phillip Hellewell <ss...@gmail.com> wrote:
>
> Also, is there a common way to let each developer decide which
> protocol they want to use, e.g., svn+ssh:// instead of http://.

Of course, the big problem with svn+ssh:// is that you have to have
the username in the URL too.  Is there a varaible, e.g., ${username},
that I can shove in there?

Phillip

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


Re: scm connection in parent pom

Posted by Phillip Hellewell <ss...@gmail.com>.
On Wed, Oct 20, 2010 at 1:38 AM, Andreas Sewe
<se...@st.informatik.tu-darmstadt.de> wrote:
> Hi Phillip,
>
>> Does it make sense and will it work to define the scm connection in a
>> parent pom if all my projects follow the same layout in SVN?
>>
>> i.e.,
>> <connection>scm:svn:http://mysvnrep.com/svn/projects/${artifactId}/trunk</connection>
>
> in theory, the above makes sense, but in practice you will encounter a
> problem: if scm/connection is inherited by a child POM, Maven automatically
> appends the equivalent of "/${project.artifactId}" to your SCM URL.

Doh!  That's too bad :(

> Thus, you end up with
> "scm:svn:http://mysvnrep.com/svn/projects/${artifactId}/trunk/${project.artifactId}",
> which is in all likelihood not what you intended. (You are aiming for a flat
> repository layout here, which parent and child on the same level, right?)

Right.

> Unfortunately, Maven is extremely prejudiced in favour of a hierarchical
> layout. But if there are any good workarounds other than copy-and-pasting
> scm/connection in all the child POMs I would love to hear about them.

Yeah, me too :)

> I hope this helps.

It does, thanks.

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


Re: scm connection in parent pom

Posted by lukewpatterson <lu...@gmail.com>.

Andreas Sewe wrote:
> 
> But if there are any good workarounds other than 
> copy-and-pasting scm/connection in all the child POMs I would love to 
> hear about them.
> 

A lot of people (30 at last count, including myself) would be interested to
see a solution for this.  Many related bugs funnel to
http://jira.codehaus.org/browse/MNG-3244
-- 
View this message in context: http://maven.40175.n5.nabble.com/scm-connection-in-parent-pom-tp3224641p3228537.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: scm connection in parent pom

Posted by Phillip Hellewell <ss...@gmail.com>.
On Thu, Oct 21, 2010 at 12:53 PM, Stephen Connolly
<st...@gmail.com> wrote:
> On 21 October 2010 16:55, Phillip Hellewell <ss...@gmail.com> wrote:
>> or inside
>> the pom where the <connection> looks like "scm:svn:infer".
>
> i'm not doing that. The pom should be complete on its own and not
> depend on where in scm it happens to be located.

alright

> mvn scm:infer
>
> will correct the scm details if incorrect and update the pom.xml

that's better than nothing, thanks :)

Phillip

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


Re: scm connection in parent pom

Posted by Stephen Connolly <st...@gmail.com>.
On 21 October 2010 16:55, Phillip Hellewell <ss...@gmail.com> wrote:
> or inside
> the pom where the <connection> looks like "scm:svn:infer".

i'm not doing that. The pom should be complete on its own and not
depend on where in scm it happens to be located.

mvn scm:infer

will correct the scm details if incorrect and update the pom.xml

-Stephen

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


Re: scm connection in parent pom

Posted by Phillip Hellewell <ss...@gmail.com>.
On Thu, Oct 21, 2010 at 2:06 AM, Stephen Connolly
<st...@gmail.com> wrote:
> On 20 October 2010 16:36, Phillip Hellewell <ss...@gmail.com> wrote:
>> But if it can be inferred while the plugin is running, why exactly
>> does it need to get written back into the pom?  Of course, I don't
>
> You did see the -Dprovider=svn

Yes.

> There are N providers not all of them can be inferred... what do we do
> if somebody has a svn workspace in a git workspace with .gitignore's
> containing .svn and svn:ignore on the root folder containing .git?
> That would allow both scm's to function at the same time without being
> aware of each other... which should maven choose?

Don't infer the SCM.  Just infer the URL.  I think it's ok if the SCM
has to be provided on the command-line (as you illustrated) or inside
the pom where the <connection> looks like "scm:svn:infer".

> Oh and this git/svn workspace could also be an accurev workspace (no
> control files needed to be ignored there) and why not add CVS into the
> mix?

Yeah, I think it would be great if over time we could add infer
ability for more SCMs.

>> mind it being written into the pom on a tag, and in the pom that goes
>> to the repo, but in the trunk and branches the whole idea is to not
>> have it present in there so it is always inferred.
>
> but you are going to have to specify at least the provider... so at
> least more than nothing will have to go in there... plus when that
> -SNAPSHOT gets deployed wouldn't it be nice to know from which branch
> it was deployed? oh look the pom has the scm details of the branch it
> came from... cool! that was joe's branch which explains why I'm fecked

Yeah, I'd be fine having <connection>scm:svn:infer</connection> in
there.  I'm also fine with having it get replaced in the pom in the
tag and in the released poms that gets deployed, but in the
trunk/branches it could stay as scm:svn:infer forever.

The only downside I can see is what you just mentioned about
snapshots.  I agree it could be helpful to know like what branch the
snapshot came from, but I still think having infer functionality has
some great benefits that for some people would outweigh this one
drawback.

Phillip

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


Re: scm connection in parent pom

Posted by Stephen Connolly <st...@gmail.com>.
On 20 October 2010 16:36, Phillip Hellewell <ss...@gmail.com> wrote:
> On Wed, Oct 20, 2010 at 1:58 AM, Stephen Connolly
> <st...@gmail.com> wrote:
>> (snip)
>> I have a bash script to update the details on a branch, etc... I am
>> looking into the possibility of adding this into the maven-scm-plugin,
>> e.g. "mvn scm:infer -Dprovider=svn" of course given that this would
>> involve rewriting the pom.xml I'll have to decide how to handle
>
> Yeah, I really like the idea of having an scm:infer.  You definitely
> got my vote!
>
> But if it can be inferred while the plugin is running, why exactly
> does it need to get written back into the pom?  Of course, I don't

You did see the -Dprovider=svn

There are N providers not all of them can be inferred... what do we do
if somebody has a svn workspace in a git workspace with .gitignore's
containing .svn and svn:ignore on the root folder containing .git?
That would allow both scm's to function at the same time without being
aware of each other... which should maven choose?

Oh and this git/svn workspace could also be an accurev workspace (no
control files needed to be ignored there) and why not add CVS into the
mix?

> mind it being written into the pom on a tag, and in the pom that goes
> to the repo, but in the trunk and branches the whole idea is to not
> have it present in there so it is always inferred.

but you are going to have to specify at least the provider... so at
least more than nothing will have to go in there... plus when that
-SNAPSHOT gets deployed wouldn't it be nice to know from which branch
it was deployed? oh look the pom has the scm details of the branch it
came from... cool! that was joe's branch which explains why I'm fecked

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

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


Re: scm connection in parent pom

Posted by Phillip Hellewell <ss...@gmail.com>.
On Wed, Oct 20, 2010 at 1:58 AM, Stephen Connolly
<st...@gmail.com> wrote:
> (snip)
> I have a bash script to update the details on a branch, etc... I am
> looking into the possibility of adding this into the maven-scm-plugin,
> e.g. "mvn scm:infer -Dprovider=svn" of course given that this would
> involve rewriting the pom.xml I'll have to decide how to handle

Yeah, I really like the idea of having an scm:infer.  You definitely
got my vote!

But if it can be inferred while the plugin is running, why exactly
does it need to get written back into the pom?  Of course, I don't
mind it being written into the pom on a tag, and in the pom that goes
to the repo, but in the trunk and branches the whole idea is to not
have it present in there so it is always inferred.

Phillip

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


Re: scm connection in parent pom

Posted by Stephen Connolly <st...@gmail.com>.
On 20 October 2010 08:51, Stephen Connolly
<st...@gmail.com> wrote:
> On 20 October 2010 08:38, Andreas Sewe
> <se...@st.informatik.tu-darmstadt.de> wrote:
>> Hi Phillip,
>>
>>> Does it make sense and will it work to define the scm connection in a
>>> parent pom if all my projects follow the same layout in SVN?
>>>
>>> i.e.,
>>> <connection>scm:svn:http://mysvnrep.com/svn/projects/${artifactId}/trunk</connection>
>>
>> in theory, the above makes sense, but in practice you will encounter a
>> problem: if scm/connection is inherited by a child POM, Maven automatically
>> appends the equivalent of "/${project.artifactId}" to your SCM URL.
>>
>
> IIRC the appending is controlled by the presence of a / at the end of the URI
>
> if the URI ends with a slash then it will not append the module name in children
>
> if the URI does not end with a slash then it will append the module
> name in children
>
> of course I could be mistaken and this might only apply to
> /project/url but I thought it also applied to /project/scm/*
>
> Another thing is that the use of ${artifactId} is deprecated and you
> should reference those properties with the project. prefix, e.g.
> ${project.artifactId}
>
> -Stephen

Finally, I am not condoning the use of properties in /project/url or
/project/scm/*

I used to do this and gave up because it can have unforseen
consequences... basically a whole slew of projects went bad because of
this and as a result I just went for including the details correctly.
I have a bash script to update the details on a branch, etc... I am
looking into the possibility of adding this into the maven-scm-plugin,
e.g. "mvn scm:infer -Dprovider=svn" of course given that this would
involve rewriting the pom.xml I'll have to decide how to handle
that... versions-maven-plugin is currently the best plugin for
rewriting the pom.xml [i.e. it does not mess up any human formatting]
but scm details may not be obviously relevant to v-m-p and I don't
really want v-m-p ending up as a dumping ground for all the pom
rewriting mojos... I'll probably end up refactoring the rewriting into
a separate artifact... might play nicer with polyglot anyway... of
course i'd probably need to finish xevpp.codehaus.org first ;-)

-Stephen

>
>> Thus, you end up with
>> "scm:svn:http://mysvnrep.com/svn/projects/${artifactId}/trunk/${project.artifactId}",
>> which is in all likelihood not what you intended. (You are aiming for a flat
>> repository layout here, which parent and child on the same level, right?)
>>
>> Unfortunately, Maven is extremely prejudiced in favour of a hierarchical
>> layout. But if there are any good workarounds other than copy-and-pasting
>> scm/connection in all the child POMs I would love to hear about them.
>>
>> I hope this helps.
>>
>> Andreas
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>

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


Re: scm connection in parent pom

Posted by Phillip Hellewell <ss...@gmail.com>.
On Wed, Oct 20, 2010 at 1:51 AM, Stephen Connolly
<st...@gmail.com> wrote:
>
> IIRC the appending is controlled by the presence of a / at the end of the URI
>
> if the URI ends with a slash then it will not append the module name in children
>
> if the URI does not end with a slash then it will append the module
> name in children

Ok, thanks.  Maybe I will give this a try, or maybe I won't worry
about it since I think your next email may convince me it's not worth
it...

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


Re: scm connection in parent pom

Posted by Stephen Connolly <st...@gmail.com>.
On 20 October 2010 14:29, Andreas Sewe
<se...@st.informatik.tu-darmstadt.de> wrote:
> Hi Stephen,
>
>> IIRC the appending is controlled by the presence of a / at the end of the
>> URI
>>
>> if the URI ends with a slash then it will not append the module name in
>> children
>>
>> if the URI does not end with a slash then it will append the module
>> name in children
>>
>> of course I could be mistaken and this might only apply to
>> /project/url but I thought it also applied to /project/scm/*
>
> you are right. This is indeed the case -- at least with Maven 3.0 (just
> tested it), although I do recall that it didn't always work like this (see
> <http://jira.codehaus.org/browse/MNG-3244>, which Luke pointed to.)
>
> That being said, can you comment on what went wrong in your setup? Would be
> interesting to know why you are so against using properties in
> /project/scm/*.
>

I gave up and moved on... I forget the why... I only remember the conculsion ;-)

-Stephen

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

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


Re: scm connection in parent pom

Posted by lukewpatterson <lu...@gmail.com>.

Andreas Sewe wrote:
> 
> ... Would be interesting to know why you are so against using properties
> in 
> /project/scm/*.
> 

Based on what I've experienced, described earlier by Jörg -


Jörg Schaible wrote:
> 
> ... the release plugin will rewrite the SCM URLs during release and 
> reolve all properties with their real values - unfortunately. 
> 
(which I think is http://jira.codehaus.org/browse/MRELEASE-412), 

there is no gain in using properties since the release plugin currently just
resolves/replaces in-place anyways.  You would have to manually edit and
reinsert the property expressions in the trunk's pom after every time you
released.
-- 
View this message in context: http://maven.40175.n5.nabble.com/scm-connection-in-parent-pom-tp3224641p3228825.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: scm connection in parent pom

Posted by Andreas Sewe <se...@st.informatik.tu-darmstadt.de>.
Hi Stephen,

> IIRC the appending is controlled by the presence of a / at the end of the URI
> 
> if the URI ends with a slash then it will not append the module name in children
> 
> if the URI does not end with a slash then it will append the module
> name in children
> 
> of course I could be mistaken and this might only apply to
> /project/url but I thought it also applied to /project/scm/*

you are right. This is indeed the case -- at least with Maven 3.0 (just 
tested it), although I do recall that it didn't always work like this 
(see <http://jira.codehaus.org/browse/MNG-3244>, which Luke pointed to.)

That being said, can you comment on what went wrong in your setup? Would 
be interesting to know why you are so against using properties in 
/project/scm/*.

Best wishes,

Andreas

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


Re: scm connection in parent pom

Posted by Stephen Connolly <st...@gmail.com>.
On 20 October 2010 08:38, Andreas Sewe
<se...@st.informatik.tu-darmstadt.de> wrote:
> Hi Phillip,
>
>> Does it make sense and will it work to define the scm connection in a
>> parent pom if all my projects follow the same layout in SVN?
>>
>> i.e.,
>> <connection>scm:svn:http://mysvnrep.com/svn/projects/${artifactId}/trunk</connection>
>
> in theory, the above makes sense, but in practice you will encounter a
> problem: if scm/connection is inherited by a child POM, Maven automatically
> appends the equivalent of "/${project.artifactId}" to your SCM URL.
>

IIRC the appending is controlled by the presence of a / at the end of the URI

if the URI ends with a slash then it will not append the module name in children

if the URI does not end with a slash then it will append the module
name in children

of course I could be mistaken and this might only apply to
/project/url but I thought it also applied to /project/scm/*

Another thing is that the use of ${artifactId} is deprecated and you
should reference those properties with the project. prefix, e.g.
${project.artifactId}

-Stephen

> Thus, you end up with
> "scm:svn:http://mysvnrep.com/svn/projects/${artifactId}/trunk/${project.artifactId}",
> which is in all likelihood not what you intended. (You are aiming for a flat
> repository layout here, which parent and child on the same level, right?)
>
> Unfortunately, Maven is extremely prejudiced in favour of a hierarchical
> layout. But if there are any good workarounds other than copy-and-pasting
> scm/connection in all the child POMs I would love to hear about them.
>
> I hope this helps.
>
> Andreas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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


Re: scm connection in parent pom

Posted by Andreas Sewe <se...@st.informatik.tu-darmstadt.de>.
Hi Phillip,

> Does it make sense and will it work to define the scm connection in a
> parent pom if all my projects follow the same layout in SVN?
> 
> i.e., <connection>scm:svn:http://mysvnrep.com/svn/projects/${artifactId}/trunk</connection>

in theory, the above makes sense, but in practice you will encounter a 
problem: if scm/connection is inherited by a child POM, Maven 
automatically appends the equivalent of "/${project.artifactId}" to your 
SCM URL.

Thus, you end up with 
"scm:svn:http://mysvnrep.com/svn/projects/${artifactId}/trunk/${project.artifactId}", 
which is in all likelihood not what you intended. (You are aiming for a 
flat repository layout here, which parent and child on the same level, 
right?)

Unfortunately, Maven is extremely prejudiced in favour of a hierarchical 
layout. But if there are any good workarounds other than 
copy-and-pasting scm/connection in all the child POMs I would love to 
hear about them.

I hope this helps.

Andreas

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