You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by webhiker <we...@mailinator.com> on 2008/10/03 12:44:54 UTC

Re: scope-import and dependencyManagement

Stephen, I don't think you are correct, it IS supposed to be used that way,
and that's what all the Maven documentation lists as examples and operating
behaviour :

http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

I'm having the exact same issue. Using identical examples to the Maven docs,
if I omit the version tag in the child pom, the build always fails with
"missing version tag" error.

There appears to be something wrong with the code. I'm running Maven 2.0.9


Stephen Connolly-2 wrote:
> 
> Each project can list _only the dependencies that it has_ while using the
> import to ensure that only a single suite of dependency versions are used,
> I
> would guess.
> 
> It's to separate inheritance from dependency management
> 
> On Tue, Sep 16, 2008 at 4:25 PM, Barry Kaplan <gr...@memelet.com> wrote:
> 
>>
>> What is the value of importing into dependencyManagement if those
>> dependencies cannot then be refered to in the regular dependencies? I'm
>> missing the purpose/value.
>> --
>> View this message in context:
>> http://www.nabble.com/scope-import-and-dependencyManagement-tp19512161p19514217.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
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/scope-import-and-dependencyManagement-tp19512161p19795461.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: scope-import and dependencyManagement

Posted by webhiker <we...@mailinator.com>.
Here's an excerpt from Maven docs about how it should work :
dependencyManagement: is used by POMs to help manage dependency information
across all of its children. If the my-parent project uses
dependencyManagement to define a dependency on junit:junit:4.0, then POMs
inheriting from this one can set their dependency giving the groupId=junit
and artifactId=junit only, then Maven will fill in the version set by the
parent. The benefits of this method are obvious. Dependency details can be
set in one central location, which will propagate to all inheriting POMs. In
addition, the version and scope of artifacts which are incorporated from
transitive dependencies may also be controlled by specifying them in a
dependency management section.



webhiker wrote:
> 
> Stephen, I don't think you are correct, it IS supposed to be used that
> way, and that's what all the Maven documentation lists as examples and
> operating behaviour :
> 
> http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
> 
> I'm having the exact same issue. Using identical examples to the Maven
> docs, if I omit the version tag in the child pom, the build always fails
> with "missing version tag" error.
> 
> There appears to be something wrong with the code. I'm running Maven 2.0.9
> 
> 
> Stephen Connolly-2 wrote:
>> 
>> Each project can list _only the dependencies that it has_ while using the
>> import to ensure that only a single suite of dependency versions are
>> used, I
>> would guess.
>> 
>> It's to separate inheritance from dependency management
>> 
>> On Tue, Sep 16, 2008 at 4:25 PM, Barry Kaplan <gr...@memelet.com>
>> wrote:
>> 
>>>
>>> What is the value of importing into dependencyManagement if those
>>> dependencies cannot then be refered to in the regular dependencies? I'm
>>> missing the purpose/value.
>>> --
>>> View this message in context:
>>> http://www.nabble.com/scope-import-and-dependencyManagement-tp19512161p19514217.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
>>>
>>>
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/scope-import-and-dependencyManagement-tp19512161p19795572.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: scope-import and dependencyManagement

Posted by Stephen Connolly <st...@gmail.com>.
Nahhh much easier

mvn -N install

in the directory where your root pom is...

that will restrict the build to the current pom only and not build the
child modules

2008/10/3 webhiker <we...@mailinator.com>:
>
> OK, so that's not the issue I was trying to discuss then.
> But for those who had the same problem as I did, I have a solution :
>
> if you have the following structure :
>
> pom.xml
> child-project1\pom.xml
> child-project2\pom.xml
>
> If you add in the depManagement to the root pom, the others will not work
> (in my case anyway) because Maven downloads the root pom from your
> repository (which in the initial case didn't have the depManagement
> definitions) instead of looking at the version on disk.
> So it's a chieck-egg problem - you can't deploy your new pom because it
> won't build!
>
> Solution is to manually copy the modified root pom either to your remote
> repository or to the local repo (USER_HOME\.m2 or whatever)
>
> cheers
>
>
> Stephen Connolly-2 wrote:
>>
>> I think you are mis-interpreting what I said.
>>
>> You have the following structure
>>
>> /pom.xml (agregator)
>>  +suite/pom.xml (the suite dependencies)
>>  +client/pom.xml (the client thing we are building)
>>  +web/pom.xml (the web ting we are building)
>>
>> If you have only one corporate pom (not shown on the tree) then you
>> can get away with everything ultimately inheriting from the corporate
>> pom by having a parent tree like
>>
>> /pom.xml ---is-a-child-of---> /suite/pom.xml
>> /client/pom.xml ---is-a-child-of---> /suite/pom.xml
>> /web/pom.xml ---is-a-child-of---> /suite/pom.xml
>> /suite/pom.xml ---is-a-child-of---> corporate-pom.xml
>>
>> And you'd put your dependencyManagement in /suite/pom.xml
>>
>> The question is why have this <scope>import</scope>
>>
>> The reason is you may have corporate standards for different
>> packagings... and they may not work in the one pom.xml
>>
>> In that case you would have
>>
>> corporate-root-pom.xml
>> corporate-jar-pom.xml ---is-a-child-of---> corporate-root-pom.xml
>> corporate-war-pom.xml ---is-a-child-of---> corporate-root-pom.xml
>>
>> And then
>> /pom.xml ---is-a-child-of---> corporate-aggregator-pom.xml
>> /client/pom.xml ---is-a-child-of---> corporate-jar-pom.xml
>> /web/pom.xml ---is-a-child-of---> corporate-war-pom.xml
>>
>> Now the problem is how do I ensure that client and web have the same
>> dependencyMangement sections?
>>
>> The answer is import scope.... so in that case you have
>>
>> /suite/pom.xml ---is-a-child-of---> corporate-root-pom.xml
>> /client/pom.xml ---is-a-child-of---> corporate-jar-pom.xml with
>> dependency on /suite/pom.xml: scope=import
>> /web/pom.xml ---is-a-child-of---> corporate-war-pom.xml with
>> dependency on /suite/pom.xml: scope=import
>>
>> I was explaining *why* you would want import scope.  I don't know *if*
>> import scope works... only *why* one would want it in the first place
>>
>> - Stephen
>>
>>
>> 2008/10/3 webhiker <we...@mailinator.com>:
>>>
>>> Stephen, I don't think you are correct, it IS supposed to be used that
>>> way,
>>> and that's what all the Maven documentation lists as examples and
>>> operating
>>> behaviour :
>>>
>>> http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
>>>
>>> I'm having the exact same issue. Using identical examples to the Maven
>>> docs,
>>> if I omit the version tag in the child pom, the build always fails with
>>> "missing version tag" error.
>>>
>>> There appears to be something wrong with the code. I'm running Maven
>>> 2.0.9
>>>
>>>
>>> Stephen Connolly-2 wrote:
>>>>
>>>> Each project can list _only the dependencies that it has_ while using
>>>> the
>>>> import to ensure that only a single suite of dependency versions are
>>>> used,
>>>> I
>>>> would guess.
>>>>
>>>> It's to separate inheritance from dependency management
>>>>
>>>> On Tue, Sep 16, 2008 at 4:25 PM, Barry Kaplan <gr...@memelet.com>
>>>> wrote:
>>>>
>>>>>
>>>>> What is the value of importing into dependencyManagement if those
>>>>> dependencies cannot then be refered to in the regular dependencies? I'm
>>>>> missing the purpose/value.
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/scope-import-and-dependencyManagement-tp19512161p19514217.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
>>>>>
>>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/scope-import-and-dependencyManagement-tp19512161p19795461.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
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/scope-import-and-dependencyManagement-tp19512161p19798389.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
>
>

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


Re: scope-import and dependencyManagement

Posted by webhiker <we...@mailinator.com>.
OK, so that's not the issue I was trying to discuss then.
But for those who had the same problem as I did, I have a solution :

if you have the following structure :

pom.xml
child-project1\pom.xml
child-project2\pom.xml

If you add in the depManagement to the root pom, the others will not work
(in my case anyway) because Maven downloads the root pom from your
repository (which in the initial case didn't have the depManagement
definitions) instead of looking at the version on disk.
So it's a chieck-egg problem - you can't deploy your new pom because it
won't build!

Solution is to manually copy the modified root pom either to your remote
repository or to the local repo (USER_HOME\.m2 or whatever)

cheers


Stephen Connolly-2 wrote:
> 
> I think you are mis-interpreting what I said.
> 
> You have the following structure
> 
> /pom.xml (agregator)
>  +suite/pom.xml (the suite dependencies)
>  +client/pom.xml (the client thing we are building)
>  +web/pom.xml (the web ting we are building)
> 
> If you have only one corporate pom (not shown on the tree) then you
> can get away with everything ultimately inheriting from the corporate
> pom by having a parent tree like
> 
> /pom.xml ---is-a-child-of---> /suite/pom.xml
> /client/pom.xml ---is-a-child-of---> /suite/pom.xml
> /web/pom.xml ---is-a-child-of---> /suite/pom.xml
> /suite/pom.xml ---is-a-child-of---> corporate-pom.xml
> 
> And you'd put your dependencyManagement in /suite/pom.xml
> 
> The question is why have this <scope>import</scope>
> 
> The reason is you may have corporate standards for different
> packagings... and they may not work in the one pom.xml
> 
> In that case you would have
> 
> corporate-root-pom.xml
> corporate-jar-pom.xml ---is-a-child-of---> corporate-root-pom.xml
> corporate-war-pom.xml ---is-a-child-of---> corporate-root-pom.xml
> 
> And then
> /pom.xml ---is-a-child-of---> corporate-aggregator-pom.xml
> /client/pom.xml ---is-a-child-of---> corporate-jar-pom.xml
> /web/pom.xml ---is-a-child-of---> corporate-war-pom.xml
> 
> Now the problem is how do I ensure that client and web have the same
> dependencyMangement sections?
> 
> The answer is import scope.... so in that case you have
> 
> /suite/pom.xml ---is-a-child-of---> corporate-root-pom.xml
> /client/pom.xml ---is-a-child-of---> corporate-jar-pom.xml with
> dependency on /suite/pom.xml: scope=import
> /web/pom.xml ---is-a-child-of---> corporate-war-pom.xml with
> dependency on /suite/pom.xml: scope=import
> 
> I was explaining *why* you would want import scope.  I don't know *if*
> import scope works... only *why* one would want it in the first place
> 
> - Stephen
> 
> 
> 2008/10/3 webhiker <we...@mailinator.com>:
>>
>> Stephen, I don't think you are correct, it IS supposed to be used that
>> way,
>> and that's what all the Maven documentation lists as examples and
>> operating
>> behaviour :
>>
>> http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
>>
>> I'm having the exact same issue. Using identical examples to the Maven
>> docs,
>> if I omit the version tag in the child pom, the build always fails with
>> "missing version tag" error.
>>
>> There appears to be something wrong with the code. I'm running Maven
>> 2.0.9
>>
>>
>> Stephen Connolly-2 wrote:
>>>
>>> Each project can list _only the dependencies that it has_ while using
>>> the
>>> import to ensure that only a single suite of dependency versions are
>>> used,
>>> I
>>> would guess.
>>>
>>> It's to separate inheritance from dependency management
>>>
>>> On Tue, Sep 16, 2008 at 4:25 PM, Barry Kaplan <gr...@memelet.com>
>>> wrote:
>>>
>>>>
>>>> What is the value of importing into dependencyManagement if those
>>>> dependencies cannot then be refered to in the regular dependencies? I'm
>>>> missing the purpose/value.
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/scope-import-and-dependencyManagement-tp19512161p19514217.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
>>>>
>>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/scope-import-and-dependencyManagement-tp19512161p19795461.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
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/scope-import-and-dependencyManagement-tp19512161p19798389.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: scope-import and dependencyManagement

Posted by Stephen Connolly <st...@gmail.com>.
I think you are mis-interpreting what I said.

You have the following structure

/pom.xml (agregator)
 +suite/pom.xml (the suite dependencies)
 +client/pom.xml (the client thing we are building)
 +web/pom.xml (the web ting we are building)

If you have only one corporate pom (not shown on the tree) then you
can get away with everything ultimately inheriting from the corporate
pom by having a parent tree like

/pom.xml ---is-a-child-of---> /suite/pom.xml
/client/pom.xml ---is-a-child-of---> /suite/pom.xml
/web/pom.xml ---is-a-child-of---> /suite/pom.xml
/suite/pom.xml ---is-a-child-of---> corporate-pom.xml

And you'd put your dependencyManagement in /suite/pom.xml

The question is why have this <scope>import</scope>

The reason is you may have corporate standards for different
packagings... and they may not work in the one pom.xml

In that case you would have

corporate-root-pom.xml
corporate-jar-pom.xml ---is-a-child-of---> corporate-root-pom.xml
corporate-war-pom.xml ---is-a-child-of---> corporate-root-pom.xml

And then
/pom.xml ---is-a-child-of---> corporate-aggregator-pom.xml
/client/pom.xml ---is-a-child-of---> corporate-jar-pom.xml
/web/pom.xml ---is-a-child-of---> corporate-war-pom.xml

Now the problem is how do I ensure that client and web have the same
dependencyMangement sections?

The answer is import scope.... so in that case you have

/suite/pom.xml ---is-a-child-of---> corporate-root-pom.xml
/client/pom.xml ---is-a-child-of---> corporate-jar-pom.xml with
dependency on /suite/pom.xml: scope=import
/web/pom.xml ---is-a-child-of---> corporate-war-pom.xml with
dependency on /suite/pom.xml: scope=import

I was explaining *why* you would want import scope.  I don't know *if*
import scope works... only *why* one would want it in the first place

- Stephen


2008/10/3 webhiker <we...@mailinator.com>:
>
> Stephen, I don't think you are correct, it IS supposed to be used that way,
> and that's what all the Maven documentation lists as examples and operating
> behaviour :
>
> http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
>
> I'm having the exact same issue. Using identical examples to the Maven docs,
> if I omit the version tag in the child pom, the build always fails with
> "missing version tag" error.
>
> There appears to be something wrong with the code. I'm running Maven 2.0.9
>
>
> Stephen Connolly-2 wrote:
>>
>> Each project can list _only the dependencies that it has_ while using the
>> import to ensure that only a single suite of dependency versions are used,
>> I
>> would guess.
>>
>> It's to separate inheritance from dependency management
>>
>> On Tue, Sep 16, 2008 at 4:25 PM, Barry Kaplan <gr...@memelet.com> wrote:
>>
>>>
>>> What is the value of importing into dependencyManagement if those
>>> dependencies cannot then be refered to in the regular dependencies? I'm
>>> missing the purpose/value.
>>> --
>>> View this message in context:
>>> http://www.nabble.com/scope-import-and-dependencyManagement-tp19512161p19514217.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
>>>
>>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/scope-import-and-dependencyManagement-tp19512161p19795461.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
>
>

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