Colin I think gave an excellent answer.  What I have found is that if I do
something like <attainGoal name="war:init"> then I can also do the
pom.getPluginContext stuff.  It feels to me like you have to initialize the
plugin by calling one of it's goals.

Eric

-----Original Message-----
From: Colin Sampaleanu [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 13, 2003 5:14 PM
To: Turbine Maven Users List
Subject: Re: Problem with WAR plugin on beta 8


Try this:
    <postGoal name="war:init">
        <echo message="maven.src.dir=${maven.src.dir}"/>
        <echo 
message="maven.war.src=${pom.getPluginContext('maven-war-plugin').getVariabl
e('maven.war.src')}"/>
    </postGoal>

You will see that there is indeed a value for maven.war.src. I think the 
way it works is like this (I have inferred this mostly from usage, not 
by looking at the code, somebody that knows better please correct me). 
The build and your maven.xml runs with its own jelly context. The 
plugins run in a context which is an amalgamation of the main context 
and the plugin's context (I will not use the word parent and child for 
reasons that will hopefully become clear). So by default you can not see 
a var in a plugin's context unless you use the mechanism above. The 
plugin on the other hand can see vars in its context, as well as the 
main one, but the main one takes precedence if something exists in both 
places. This is why when you put the same property in your 
project.properties, it creates a var in the main context, and that is 
used instead by the plugin. What I personally do not understand (and 
blows away the above explanation a bit) is the fact that if you simply 
create the same property as a var, in maven.xml, instead of using 
project.properties, it does not seem to override the plugin's property.

Anyways, the long and the short of it is that you can override the value 
by using a property in project.properties, and if you need to override 
it only via maven.xml (ie programmatically as a jelly script without an 
entry in your project.properties), then you should access it as above, 
where you will actually be accessing in the plugin's context.


Quinton McCombs wrote:

>I am trying to use some of the properties defined in plugin.properties
>in my maven.xml file.  For example, I have a postGoal defined for
>war:init that copies my web.xml and various configuration files into the
>correct location in the maven.war.src directory.  These variables are
>evaluating to "".
>
>I can get around this problem by defining the properties in my
>project.properties file.
>
>  
>
>>-----Original Message-----
>>From: Kurt Schrader [mailto:[EMAIL PROTECTED]] 
>>Sent: Thursday, February 13, 2003 3:04 PM
>>To: Turbine Maven Users List
>>Subject: Re: Problem with WAR plugin on beta 8
>>
>>
>>I am using b8 with the war plug-in and it's working fine 
>>here.  Can you supply any more info?
>>
>>-Kurt
>>
>>On Thu, 13 Feb 2003, Quinton McCombs wrote:
>>
>>    
>>
>>>It appears that the plugin.properties file in the war plugin is not 
>>>being processed.  According to the plugin.properties file, 
>>>maven.war.src is set to ${maven.src.dir}/webapp.  However does not 
>>>seem to be set.  I added the following to my maven.xml file:
>>>
>>>    <postGoal name="war:init">
>>>        <echo message="maven.src.dir=${maven.src.dir}"/>
>>>        <echo message="maven.war.src=${maven.war.src}"/>
>>>    <postGoal>
>>>
>>>The result is:
>>>    [echo] maven.src.dir=C:\sourceCode\neo/src
>>>    [echo] maven.war.src=
>>>      
>>>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to