You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by EP...@upstate.com on 2003/01/30 19:19:00 UTC

Discovered Something About Plugin Context

Hi all,

A couple weeks ago I posted a note about my goal in maven.xml failing:

 <goal name="testplugin">
    <j:set var="checkValue"
value="${pom.getPluginContext('maven-war-plugin').getVariable('maven.war.src
')}"/>
    
    <j:set var="genDocs"
value="${pom.getPluginContext('maven-xdoc-plugin').getVariable('maven.gen.do
cs')}" />
    <echo>
      Here is test1:
${pom.getPluginContext('maven-xdoc-plugin').getVariable('maven.gen.docs')}
      Here is test 2: ${checkValue}
      Here is test genDocs: ${genDocs}
    </echo>
  </goal>

What happens is nothing is actually set.  Today, I discovered that if I
first call any plugin goal, say war.init, then all plugins are populated:

 <goal name="testplugin">
    <attainGoal name="war:init"/>
    <j:set var="checkValue"
value="${pom.getPluginContext('maven-war-plugin').getVariable('maven.war.src
')}"/>
    
    <j:set var="genDocs"
value="${pom.getPluginContext('maven-xdoc-plugin').getVariable('maven.gen.do
cs')}" />
    <echo>
      Here is maven.war.src:
${pom.getPluginContext('maven-xdoc-plugin').getVariable('maven.gen.docs')}
      Here is test 2: ${checkValue}
      Here is test genDocs: ${genDocs}
    </echo>
  
  </goal>

So now I get something for my values.  Is there a goal out there that I
should use to initialize or whatever it is that gets all the variables set
up?  I guess I am kinda asking a best practices question.

Eric