Quantcast

Can't specify distributionManagement in settings.xml

classic Classic list List threaded Threaded
75 messages Options
1234
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Can't specify distributionManagement in settings.xml

Phillip Hellewell
I can specify <repositories> in a profile in my settings.xml for
downloading artifacts, but I don't seem to be able to specify
<distributionManagement> in there.  No matter what I try it gives an
error "Unrecognised tag: 'distributionManagement'".

I don't want to have to specify the url of my company repository in
every single POM.  What could I be doing wrong?

Thanks,
Phillip

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Can't specify distributionManagement in settings.xml

Wendy Smoak
On Mon, Oct 4, 2010 at 12:07 PM, Phillip Hellewell <[hidden email]> wrote:

> I can specify <repositories> in a profile in my settings.xml for
> downloading artifacts, but I don't seem to be able to specify
> <distributionManagement> in there.  No matter what I try it gives an
> error "Unrecognised tag: 'distributionManagement'".

Google 'Maven settings model' to find
http://maven.apache.org/ref/2.2.1/maven-settings/settings.html and
look at what is allowed in settings.xml.  As you've already
discovered, distributionManagement doesn't go there.

> I don't want to have to specify the url of my company repository in
> every single POM.  What could I be doing wrong?

Put it in a top-level organization level pom, from which all of your
projects inherit.

--
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Can't specify distributionManagement in settings.xml

Phillip Hellewell
On Mon, Oct 4, 2010 at 10:10 AM, Wendy Smoak <[hidden email]> wrote:
> On Mon, Oct 4, 2010 at 12:07 PM, Phillip Hellewell <[hidden email]> wrote:
>
>> I don't want to have to specify the url of my company repository in
>> every single POM.  What could I be doing wrong?
>
> Put it in a top-level organization level pom, from which all of your
> projects inherit.

Thanks.  That worked just great.

It does feel kinda inconsistent though, that I can specify
repositories to download from in settings.xml, but I can't specify a
default repository to upload to when deploying.

Phillip

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Can't specify distributionManagement in settings.xml

Phillip Hellewell
On Mon, Oct 4, 2010 at 10:25 AM, Phillip Hellewell <[hidden email]> wrote:
> On Mon, Oct 4, 2010 at 10:10 AM, Wendy Smoak <[hidden email]> wrote:
>>
>> Put it in a top-level organization level pom, from which all of your
>> projects inherit.
>
> Thanks.  That worked just great.

Crap, this is not working out.  Now I'm getting an error later on when
I try to depend on this project because the parent pom can't be found.
 But I don't want to put the parent pom in the repository or anything.
 I just wanted to use it to provide the distributionManagement
setting.

Phillip

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Can't specify distributionManagement in settings.xml

Anders Hammar
Are you seeing the pattern yet? Don't fight Maven!

/Anders

On Mon, Oct 4, 2010 at 20:24, Phillip Hellewell <[hidden email]> wrote:

> On Mon, Oct 4, 2010 at 10:25 AM, Phillip Hellewell <[hidden email]>
> wrote:
> > On Mon, Oct 4, 2010 at 10:10 AM, Wendy Smoak <[hidden email]> wrote:
> >>
> >> Put it in a top-level organization level pom, from which all of your
> >> projects inherit.
> >
> > Thanks.  That worked just great.
>
> Crap, this is not working out.  Now I'm getting an error later on when
> I try to depend on this project because the parent pom can't be found.
>  But I don't want to put the parent pom in the repository or anything.
>  I just wanted to use it to provide the distributionManagement
> setting.
>
> Phillip
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Can't specify distributionManagement in settings.xml

Phillip Hellewell
On Mon, Oct 4, 2010 at 12:31 PM, Anders Hammar <[hidden email]> wrote:
> Are you seeing the pattern yet? Don't fight Maven!

Hehe, yeah I am.  But using a parent pom for this setting is still not
making complete sense to me, so I've got to play with it some more and
hopefully it will.

Phillip

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Can't specify distributionManagement in settings.xml

Phillip Hellewell
On Mon, Oct 4, 2010 at 12:43 PM, Phillip Hellewell <[hidden email]> wrote:
> On Mon, Oct 4, 2010 at 12:31 PM, Anders Hammar <[hidden email]> wrote:
>> Are you seeing the pattern yet? Don't fight Maven!
>
> Hehe, yeah I am.  But using a parent pom for this setting is still not
> making complete sense to me, so I've got to play with it some more and
> hopefully it will.

Ok, I figured out what I feel is a valid and good solution.  Not sure
why I didn't think of this before, but in the default profile in my
settings.xml I can simply define a property called "repos.url", right
where I define my repository.  Then I can use that same property in my
distributionManagement section in any of my poms that I want to.

So something like this goes in my settings.xml:
  <profiles>
    <profile>
      <id>default</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <repos.url>file:///c:/test123</repos.url>
      </properties>
      <repositories>
        <repository>
          <id>test123</id>
          <name>test</name>
          <url>${repos.url}</url>
        </repository>
      </repositories>
    </profile>
  </profiles>

And something like this goes in my pom files:
  <distributionManagement>
    <repository>
      <id>myrepos</id>
      <url>${repos.url}</url>
    </repository>
  </distributionManagement>

The other advantage here is that I can pass in repos.url on the
command-line with -D if I want to deploy to another repository.

I hope you won't tell me this is the "wrong" way, because it seems
like a perfectly valid approach to me.

Phillip

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Can't specify distributionManagement in settings.xml

Eric Haszlakiewicz
In reply to this post by Anders Hammar
>-----Original Message-----
>From: [hidden email] [mailto:[hidden email]] On
>
>Are you seeing the pattern yet? Don't fight Maven!

So what IS the pattern here?  How do you actually configure the
distribution management if you're not going to put it in a parent pom?

Saying "don't fight maven" is rather useless if you don't explain how
you're actually supposed to get things to work.

eric

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Can't specify distributionManagement in settings.xml

Thiessen, Todd (Todd)
In reply to this post by Phillip Hellewell
Hehe. Not so sure I'd say "wrong", but definitely unnecessary.

Why are you opposed to putting this information in a the distribution management section of a parent pom?

> -----Original Message-----
> From: Phillip Hellewell [mailto:[hidden email]]
> Sent: Monday, October 04, 2010 3:05 PM
> To: Maven Users List
> Subject: Re: Can't specify distributionManagement in settings.xml
>
> On Mon, Oct 4, 2010 at 12:43 PM, Phillip Hellewell <[hidden email]>
> wrote:
> > On Mon, Oct 4, 2010 at 12:31 PM, Anders Hammar <[hidden email]>
> wrote:
> >> Are you seeing the pattern yet? Don't fight Maven!
> >
> > Hehe, yeah I am.  But using a parent pom for this setting is still not
> > making complete sense to me, so I've got to play with it some more and
> > hopefully it will.
>
> Ok, I figured out what I feel is a valid and good solution.  Not sure
> why I didn't think of this before, but in the default profile in my
> settings.xml I can simply define a property called "repos.url", right
> where I define my repository.  Then I can use that same property in my
> distributionManagement section in any of my poms that I want to.
>
> So something like this goes in my settings.xml:
>   <profiles>
>     <profile>
>       <id>default</id>
>       <activation>
>         <activeByDefault>true</activeByDefault>
>       </activation>
>       <properties>
>         <repos.url>file:///c:/test123</repos.url>
>       </properties>
>       <repositories>
>         <repository>
>           <id>test123</id>
>           <name>test</name>
>           <url>${repos.url}</url>
>         </repository>
>       </repositories>
>     </profile>
>   </profiles>
>
> And something like this goes in my pom files:
>   <distributionManagement>
>     <repository>
>       <id>myrepos</id>
>       <url>${repos.url}</url>
>     </repository>
>   </distributionManagement>
>
> The other advantage here is that I can pass in repos.url on the
> command-line with -D if I want to deploy to another repository.
>
> I hope you won't tell me this is the "wrong" way, because it seems
> like a perfectly valid approach to me.
>
> Phillip
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Can't specify distributionManagement in settings.xml

Eric Haszlakiewicz
>-----Original Message-----
>From: Thiessen, Todd (Todd) [mailto:[hidden email]]
>
>Hehe. Not so sure I'd say "wrong", but definitely unnecessary.
>
>Why are you opposed to putting this information in a the distribution
>management section of a parent pom?

See the email I wrote in the "Company-wide settings" thread (Message-ID:
<[hidden email]>
).  

If you put this in a parent pom, it becomes very hard to change it, and
this feels like arbitrary, mutable, local configuration that shouldn't
get hard coded into the builds.

Phillip's idea of using a property sounds pretty useful to me. (thanks!)

eric

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Can't specify distributionManagement in settings.xml

Phillip Hellewell
On Mon, Oct 4, 2010 at 1:23 PM, Haszlakiewicz, Eric
<[hidden email]> wrote:
>
> If you put this in a parent pom, it becomes very hard to change it, and
> this feels like arbitrary, mutable, local configuration that shouldn't
> get hard coded into the builds.

Yeah, I think Eric pretty much nailed it.  In addition to what Eric
said, for me it is also the fact that why should I mess with another
pom file unnecessarily?  That and the fact that I tried it and
couldn't get it working, even after deploying the parent pom.

So anyway, setting a property in the settings.xml seems like the best
approach to me.

Phillip

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Can't specify distributionManagement in settings.xml

Arnaud Héritier
In reply to this post by Phillip Hellewell
Wrong :-)
Let me try to explain ...
Your approach to allow to override this parameter using a property is good.
I'm doing it to validate a new version of my repository manager and so on.
But how you are doing it is wrong.
You should avoid to use a profile with activeByDefault activation. Why ? Because unlike its name could make you think, by default isn't always activated but only if no other profile is used. Thus as soon as you'll use another profile (for a release, a ci server, ...) this one won't be here, your property won't be set, and your deployment will fail.
The recommended solution is to define a default value in the property of you pom outside of any profile.
This one will be the real default. You'll have it in any case except if you override the value :
- with a property set in a profile activated in the project
- with a property set in a profile activated in your user settings
- with a property set in the command line (-D)
You can find a sample of that in my corporate pom : http://svn.exoplatform.org/projects/parent/trunk/pom.xml
You'll notice I'm using a lot of properties to allow users/projects to easily override settings they want to change without having to wrige a large block of xml settings.

Arnaud Héritier
Software Factory Manager
http://www.exoplatform.com

Phone : +33 (0)6 89 74 64 24
Skype : aheritier
Twitter : @aheritier
Blog : http://aheritier.net

On Oct 4, 2010, at 9:04 PM, Phillip Hellewell wrote:

> On Mon, Oct 4, 2010 at 12:43 PM, Phillip Hellewell <[hidden email]> wrote:
>> On Mon, Oct 4, 2010 at 12:31 PM, Anders Hammar <[hidden email]> wrote:
>>> Are you seeing the pattern yet? Don't fight Maven!
>>
>> Hehe, yeah I am.  But using a parent pom for this setting is still not
>> making complete sense to me, so I've got to play with it some more and
>> hopefully it will.
>
> Ok, I figured out what I feel is a valid and good solution.  Not sure
> why I didn't think of this before, but in the default profile in my
> settings.xml I can simply define a property called "repos.url", right
> where I define my repository.  Then I can use that same property in my
> distributionManagement section in any of my poms that I want to.
>
> So something like this goes in my settings.xml:
>  <profiles>
>    <profile>
>      <id>default</id>
>      <activation>
>        <activeByDefault>true</activeByDefault>
>      </activation>
>      <properties>
>        <repos.url>file:///c:/test123</repos.url>
>      </properties>
>      <repositories>
>        <repository>
>          <id>test123</id>
>          <name>test</name>
>          <url>${repos.url}</url>
>        </repository>
>      </repositories>
>    </profile>
>  </profiles>
>
> And something like this goes in my pom files:
>  <distributionManagement>
>    <repository>
>      <id>myrepos</id>
>      <url>${repos.url}</url>
>    </repository>
>  </distributionManagement>
>
> The other advantage here is that I can pass in repos.url on the
> command-line with -D if I want to deploy to another repository.
>
> I hope you won't tell me this is the "wrong" way, because it seems
> like a perfectly valid approach to me.
>
> Phillip
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Can't specify distributionManagement in settings.xml

Phillip Hellewell
2010/10/4 Arnaud Héritier <[hidden email]>:
> Wrong :-)
> Let me try to explain ...
> Your approach to allow to override this parameter using a property is good.
> I'm doing it to validate a new version of my repository manager and so on.
> But how you are doing it is wrong.

I didn't know I could define properties outside of a profile section.
Let me give it a try...

Thanks,
Phillip

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Can't specify distributionManagement in settings.xml

Thiessen, Todd (Todd)
In reply to this post by Eric Haszlakiewicz
I don't think it is arbitary. Where you deploy your artifacts TO, I think should be fixed. I think that is the intent. It is a one off thing that is applicable to the build at hand and isn't something you will want to try and reproduce at a later date (like building from a tag).

In this case it is good to know that if you run a mvn deploy, you'll know exactly where the artifact will go. Using it as a property or variable in this case I think isn't a good thing.

Think of this way. You want to have complete control over the artifacts that your build produces. Something fixed... predicatable. The artifacts that are produced by some other project that you need as depedendencies; you should have control over where they will be found and that may change over time. These are thus not fixed.

But that is my view. Fill your boots if you wish to define it as a property ;-).

> -----Original Message-----
> From: Haszlakiewicz, Eric [mailto:[hidden email]]
> Sent: Monday, October 04, 2010 3:24 PM
> To: Maven Users List
> Subject: RE: Can't specify distributionManagement in settings.xml
>
> >-----Original Message-----
> >From: Thiessen, Todd (Todd) [mailto:[hidden email]]
> >
> >Hehe. Not so sure I'd say "wrong", but definitely unnecessary.
> >
> >Why are you opposed to putting this information in a the distribution
> >management section of a parent pom?
>
> See the email I wrote in the "Company-wide settings" thread (Message-ID:
> <[hidden email]>
> ).
>
> If you put this in a parent pom, it becomes very hard to change it, and
> this feels like arbitrary, mutable, local configuration that shouldn't
> get hard coded into the builds.
>
> Phillip's idea of using a property sounds pretty useful to me. (thanks!)
>
> eric
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Can't specify distributionManagement in settings.xml

Phillip Hellewell
In reply to this post by Phillip Hellewell
On Mon, Oct 4, 2010 at 1:36 PM, Phillip Hellewell <[hidden email]> wrote:
> 2010/10/4 Arnaud Héritier <[hidden email]>:
>> Wrong :-)
>> Let me try to explain ...
>> Your approach to allow to override this parameter using a property is good.
>> I'm doing it to validate a new version of my repository manager and so on.
>> But how you are doing it is wrong.
>
> I didn't know I could define properties outside of a profile section.
> Let me give it a try...

Crap, you can't do that in a settings.xml.  To do it outside of a
profile section it has to be in a pom, so that leads me back to having
to use a parent or "corporate" pom :(

Phillip

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Can't specify distributionManagement in settings.xml

Thiessen, Todd (Todd)
Hehe. It always gets back to that.

Not sure why your hung up over it ;-).

What Arnaud is saying does make more sense to me. There is at least a fixed place in some POM in source control which defines the default location of where to deploy to. At least this is tracable.

I am not really all that found of making it a variable though. That just sounds like extra work for very little gain.

> -----Original Message-----
> From: Phillip Hellewell [mailto:[hidden email]]
> Sent: Monday, October 04, 2010 3:40 PM
> To: Maven Users List
> Subject: Re: Can't specify distributionManagement in settings.xml
>
> On Mon, Oct 4, 2010 at 1:36 PM, Phillip Hellewell <[hidden email]>
> wrote:
> > 2010/10/4 Arnaud Héritier <[hidden email]>:
> >> Wrong :-)
> >> Let me try to explain ...
> >> Your approach to allow to override this parameter using a property is
> good.
> >> I'm doing it to validate a new version of my repository manager and so
> on.
> >> But how you are doing it is wrong.
> >
> > I didn't know I could define properties outside of a profile section.
> > Let me give it a try...
>
> Crap, you can't do that in a settings.xml.  To do it outside of a
> profile section it has to be in a pom, so that leads me back to having
> to use a parent or "corporate" pom :(
>
> Phillip
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Can't specify distributionManagement in settings.xml

Phillip Hellewell
In reply to this post by Thiessen, Todd (Todd)
On Mon, Oct 4, 2010 at 1:36 PM, Thiessen, Todd (Todd)
<[hidden email]> wrote:
> I don't think it is arbitary. Where you deploy your artifacts TO, I think should be fixed. I think that is the intent. It is a one off thing that is applicable to the build at hand and isn't something you will want to try and reproduce at a later date (like building from a tag).
>
> In this case it is good to know that if you run a mvn deploy, you'll know exactly where the artifact will go. Using it as a property or variable in this case I think isn't a good thing.

I can see where you're coming from, and of course I don't plan on
having where we deploy to change very often, but I don't see any big
reason to prevent an override.

But anyway, that is neither here nor there for me.  The big problem
issue for me right now is why should I be forced to do everything
through a parent pom instead of in a settings.xml file?  I don't
understand why certain settings should have to be in a pom that has to
be deployed.

Phillip

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Can't specify distributionManagement in settings.xml

Arnaud Héritier
In reply to this post by Phillip Hellewell
yes, which is a best practice :-)
It can work like that too :
- In your pom you put the distributionMgt with the property
- in your settings you create a profile with this property but instead of using an activation activateByDefault  you define it in activatedProfiles list.
It will work but I think Maven 3 will write a warning because your build is dependent of your environment (which is wrong).

In Maven 3 we didn't touch to settings nor pom but we have always in mind to propose more interesting features in a near future. Like mixins which will allow to integrate several parts of pom or settings

Arnaud



On Oct 4, 2010, at 9:39 PM, Phillip Hellewell wrote:

> On Mon, Oct 4, 2010 at 1:36 PM, Phillip Hellewell <[hidden email]> wrote:
>> 2010/10/4 Arnaud Héritier <[hidden email]>:
>>> Wrong :-)
>>> Let me try to explain ...
>>> Your approach to allow to override this parameter using a property is good.
>>> I'm doing it to validate a new version of my repository manager and so on.
>>> But how you are doing it is wrong.
>>
>> I didn't know I could define properties outside of a profile section.
>> Let me give it a try...
>
> Crap, you can't do that in a settings.xml.  To do it outside of a
> profile section it has to be in a pom, so that leads me back to having
> to use a parent or "corporate" pom :(
>
> Phillip
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Can't specify distributionManagement in settings.xml

Phillip Hellewell
In reply to this post by Thiessen, Todd (Todd)
On Mon, Oct 4, 2010 at 1:43 PM, Thiessen, Todd (Todd)
<[hidden email]> wrote:
> Hehe. It always gets back to that.
>
> Not sure why your hung up over it ;-).

Well, I'm going to do some more tests now to see if I can get this
working with a parent pom.  If I run into an error that I can't figure
out you'll probably hear from me :)

But I do have one question first.  Is there any possible way to do a
deploy without any <distributionManagement> section in your pom, and
to just pass the URL on the command-line?

Phillip

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Can't specify distributionManagement in settings.xml

Thiessen, Todd (Todd)
In reply to this post by Phillip Hellewell
I think where you deploy to isn't in the settings.xml file because there there is no need for it.  Where you get artifacts from does have a specific need.

It sounds like a nice to have feature, but I don't think there is a dire need for it from the community.

>
> But anyway, that is neither here nor there for me.  The big problem
> issue for me right now is why should I be forced to do everything
> through a parent pom instead of in a settings.xml file?  I don't
> understand why certain settings should have to be in a pom that has to
> be deployed.

1234
Loading...