You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Lach, Thierry" <Th...@bbdodetroit.com> on 2005/07/28 18:27:07 UTC

Setting maven.repo.list dynamically - possible bug?

I'm trying to set maven.repo.list in a plugin but it does not seem to
work.  We are using ear:deploy to copy ear files not only to the maven
repository, but to pseudo-repositories on our test and production
application servers to help ensure that all versions on all servers are
identical.  We use a convention that a production deploy version number
ends in a -prod.  I'm trying to write my plugin so that maven.repo.list
is set to the maven repository and the two test servers if not a
production, and to the maven repository, two test servers, and the three
production servers if it IS a production version.

Code follows:

  <!-- ================================================================
-->
  <!-- ===== ear goals                                            =====
-->
  <!-- ================================================================
-->

  <preGoal name="ear:deploy">
    <j:set var="repolist" value="REPOSITORY,TEST03,TEST04"/>
    <j:if test="${pom.currentVersion.endsWith('prod')}">
      <j:set var="repolist"
value="REPOSITORY,TEST03,TEST04,PROD05,PROD06,PROD07"/>
    </j:if>
    <maven:set plugin="maven-artifact-plugin"
               property="maven.repo.list"
               value="${repolist}"/>
    <echo>maven.repo.list should be set to ${repolist}</echo>
    <maven:get var="setrepo"
               property="maven.repo.list"
               plugin="maven-artifact-plugin"/>
    <echo>maven.repo.list was set to ${setrepo}</echo>
  </preGoal>


When I run ear:deploy, I get the following (without  having
maven.repo.list set anywhere):

ear:deploy:
    [echo] maven.repo.list should be set to REPOSITORY,TEST03,TEST04
    [echo] maven.repo.list was set to REPOSITORY,TEST03,TEST04
    [echo] maven.repo.list is not set - using legacy deploy mode
    [echo] DEPRECATED: use of deploy:artifact tag and the legacy deploy
method are deprecated

The first two echo lines are coming from my pre-goal and it appears that
the value is being set properly but the artifact plugin is not
respecting the value set using maven:set tag.

Am I doing something wrong or is this a bug?



This message and any attachments contain information, which may be confidential or privileged.  If you are not the intended recipient, please refrain from any disclosure, copying, distribution or use of this information.  Please be aware that such actions are prohibited.  If you have received this transmission in error, kindly notify us by calling 1-800-262-4723 or e-mail to helpdesk@bbdo.com. We appreciate your cooperation.

Re: Setting maven.repo.list dynamically - possible bug?

Posted by Andy Glick <an...@acm.org>.
> On 7/29/05, Lach, Thierry <Th...@bbdodetroit.com> wrote:
> 
>>I'm trying to set maven.repo.list in a plugin but it does not seem to
>>work.  We are using ear:deploy to copy ear files not only to the maven
>>repository, but to pseudo-repositories on our test and production
>>application servers to help ensure that all versions on all servers are
>>identical.  We use a convention that a production deploy version number
>>ends in a -prod.  I'm trying to write my plugin so that maven.repo.list
>>is set to the maven repository and the two test servers if not a
>>production, and to the maven repository, two test servers, and the three
>>production servers if it IS a production version.
>>

Brett Porter wrote:
> THis is a limitation of maven:get/set - the plugin must be initialised
> first. Try adding xmlns:artifact="artifact" to your
> maven.xml/plugin.jelly.
> 
> Alternatively, use j:set scope="parent" var="maven.repo.list" ...
> 

Lach, Thierry replied:

I was not able to get it to work at all using maven:set/get - even after
including the artifact xmlns in both plugin.jelly and the calling
maven.xml - and even after executing <artifact:check-legacy> as part of
a pregoal for "build:start".

I WAS able to get it running using <j:set scope="parent">, but not
precisely the way I wanted.  I tried to execute the <j:set
scope="parent"> in a tag defined in the plugin that was called by the
preGoal in the plugin, but it didn't work.  It only worked when the
preGoal in my plugin.jelly directly executed the <j:set scope="parent">.


I ask:

What is "it" that declaring the artifact namespace is supposed to do, and how should that be different, if it should, from what one might expect that setting <j:set scope="parent"> would do?

Brett, do you have any sense why Thierry couldn't inject a property into the plugin when he included the artifact namespace in both his plugin and his maven.xml file, but that it worked when he set the scope to parent?


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


Re: Setting maven.repo.list dynamically - possible bug?

Posted by Brett Porter <br...@gmail.com>.
THis is a limitation of maven:get/set - the plugin must be initialised
first. Try adding xmlns:artifact="artifact" to your
maven.xml/plugin.jelly.

Alternatively, use j:set scope="parent" var="maven.repo.list" ...

- Brett

On 7/29/05, Lach, Thierry <Th...@bbdodetroit.com> wrote:
> 
> I'm trying to set maven.repo.list in a plugin but it does not seem to
> work.  We are using ear:deploy to copy ear files not only to the maven
> repository, but to pseudo-repositories on our test and production
> application servers to help ensure that all versions on all servers are
> identical.  We use a convention that a production deploy version number
> ends in a -prod.  I'm trying to write my plugin so that maven.repo.list
> is set to the maven repository and the two test servers if not a
> production, and to the maven repository, two test servers, and the three
> production servers if it IS a production version.
> 
> Code follows:
> 
>   <!-- ================================================================
> -->
>   <!-- ===== ear goals                                            =====
> -->
>   <!-- ================================================================
> -->
> 
>   <preGoal name="ear:deploy">
>     <j:set var="repolist" value="REPOSITORY,TEST03,TEST04"/>
>     <j:if test="${pom.currentVersion.endsWith('prod')}">
>       <j:set var="repolist"
> value="REPOSITORY,TEST03,TEST04,PROD05,PROD06,PROD07"/>
>     </j:if>
>     <maven:set plugin="maven-artifact-plugin"
>                property="maven.repo.list"
>                value="${repolist}"/>
>     <echo>maven.repo.list should be set to ${repolist}</echo>
>     <maven:get var="setrepo"
>                property="maven.repo.list"
>                plugin="maven-artifact-plugin"/>
>     <echo>maven.repo.list was set to ${setrepo}</echo>
>   </preGoal>
> 
> 
> When I run ear:deploy, I get the following (without  having
> maven.repo.list set anywhere):
> 
> ear:deploy:
>     [echo] maven.repo.list should be set to REPOSITORY,TEST03,TEST04
>     [echo] maven.repo.list was set to REPOSITORY,TEST03,TEST04
>     [echo] maven.repo.list is not set - using legacy deploy mode
>     [echo] DEPRECATED: use of deploy:artifact tag and the legacy deploy
> method are deprecated
> 
> The first two echo lines are coming from my pre-goal and it appears that
> the value is being set properly but the artifact plugin is not
> respecting the value set using maven:set tag.
> 
> Am I doing something wrong or is this a bug?
> 
> 
> 
> This message and any attachments contain information, which may be confidential or privileged.  If you are not the intended recipient, please refrain from any disclosure, copying, distribution or use of this information.  Please be aware that such actions are prohibited.  If you have received this transmission in error, kindly notify us by calling 1-800-262-4723 or e-mail to helpdesk@bbdo.com. We appreciate your cooperation.
>

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