Hi,

I am submitting the patches for the maven console issue. The solution is a long one and some more goals can be extracted out of it to make it cleaner.
Meanwhile please test and review the patch and provide feedback.
The plugin.jelly patch has to be applied to ~/.maven/cache/maven-console-plugin-1.1/plugin.jelly

This solution will require an entry in the README.txt file because after checkout from repository, the user will have to apply the plugin.jelly patch for the console to work properly.
Another solution is to copy the plugin.jelly contents and put them in maven.xml in either tck20 or trunk. This way the console goal in the maven.xml will override the one available in plugin.jelly. As a result, the plugin.jelly patch would no longer be required.

PS: the patch for plugin.jelly is created using the linux diff command because plugin.jelly was not part of the svn repository. I am not a very heavy linux user and just know some basic commands on it. So , if there are any switches or options available to create a more svn like patch, then let me know please.

--
Karan Malhi
36,38c36
<           <util:tokenize var="propertyPieces" delim="=">${goal}</util:tokenize>
<           <log:info>Setting property ${propertyPieces[0]} to ${propertyPieces[1]}</log:info>
<           <j:set var="${propertyPieces[0]}" value="${propertyPieces[1]}" scope="parent" />
---
>           <attainGoal name="console:setProps" />
68a67,72
>   <goal name="console:setProps">
>       <util:tokenize var="propertyPieces"  delim="=">${goal}</util:tokenize>
>       <log:info>Setting property ${propertyPieces[0]} to ${propertyPieces[1]}</log:info>
>       <j:set var="${propertyPieces[0]}" value="${propertyPieces[1]}" scope="parent" />
>       <j:set var="propertyPieces" value="${propertyPieces}" scope="parent" />
>   </goal>    
Index: trunk/tck20/maven.xml
===================================================================
--- trunk/tck20/maven.xml	(revision 290865)
+++ trunk/tck20/maven.xml	(working copy)
@@ -78,10 +78,120 @@
     <!-- ================== -->
     <!-- Set properties     -->
     <!-- ================== -->
+    <preGoal name="console">
+       <j:set var="consolemode" value='true' />
+       <j:set var="propertySetUsingConsole" value="false"/>
+    </preGoal>
+    <postGoal name="console:setProps">
+        <j:set var="propertySetUsingConsole" value="true" />
+        <j:set var="nameOfProperty" value="${propertyPieces[0]}" />
+        <attainGoal name="setProps"/>
+    </postGoal>
+    
+    <preGoal name="setProps">
 
+        <j:if test="${context.getVariable('consolemode') == 'true' }">
+           <j:set var='ranSetPropsOnce' value='${ranSetPropsOnce}' />
+           <j:if test="${ranSetPropsOnce == null}">
+              <j:set var="ranSetPropsOnce" value="false" />
+           </j:if>
+            <j:if test="${ranSetPropsOnce == 'true'}">
+            <!-- IF YOU SET A PROPERTY WHEN STARTING CONSOLE -->
+                <j:if test="${propertySetUsingConsole == 'false'}">
+                  <j:new var="tempcfglist" className="java.lang.StringBuffer" />
+                  <j:set var="tempVar" value="${jdo.tck.cfglist}" />
+                  <j:forEach var='cfglistitem' items="${tempVar.iterator()}">
+                      <j:set var="foo" value='${tempcfglist.append(cfglistitem).append(" ")}' />
+                  </j:forEach>
+                  <j:set var="jdo.tck.cfglist" value="${tempcfglist}" /> 
+                  <j:new var="tempidentitytypes" className="java.lang.StringBuffer" />
+                  <j:set var="tempVar" value="${jdo.tck.identitytypes}" />
+                  <j:forEach var='identitytypesitem' items="${tempVar.iterator()}">
+                      <j:set var="foo" value='${tempidentitytypes.append(identitytypesitem).append(" ")}' />
+                  </j:forEach>
+                  <j:set var="jdo.tck.identitytypes" value="${tempidentitytypes}" /> 
+                  <j:new var="tempdblist" className="java.lang.StringBuffer" />
+                  <j:set var="tempVar" value="${jdo.tck.dblist}" />
+                  <j:forEach var='dblistitem' items="${tempVar.iterator()}">
+                      <j:set var="foo" value='${tempdblist.append(dblistitem).append(" ")}' />
+                  </j:forEach>
+                  <j:set var="jdo.tck.dblist" value="${tempdblist}" /> 
+                 </j:if>
+            <!-- IF YOU SET A PROPERTY WHILE MAVEN CONSOLE IS RUNNING -->
+                <j:if test="${propertySetUsingConsole}">
+                    <j:choose>
+                        <j:when test="${nameOfProperty == 'jdo.tck.cfglist'}" >
+                            <j:new var="tempidentitytypes" className="java.lang.StringBuffer" />
+                            <j:set var="tempVar" value="${jdo.tck.identitytypes}" />
+                            <j:forEach var='identitytypesitem' items="${tempVar.iterator()}">
+                                <j:set var="foo" value='${tempidentitytypes.append(identitytypesitem).append(" ")}' />
+                            </j:forEach>
+                            <j:set var="jdo.tck.identitytypes" value="${tempidentitytypes}" /> 
+                            <j:new var="tempdblist" className="java.lang.StringBuffer" />
+                            <j:set var="tempVar" value="${jdo.tck.dblist}" />
+                            <j:forEach var='dblistitem' items="${tempVar.iterator()}">
+                                <j:set var="foo" value='${tempdblist.append(dblistitem).append(" ")}' />
+                            </j:forEach>
+                            <j:set var="jdo.tck.dblist" value="${tempdblist}" />    
+                        </j:when>
+                        <j:when test="${nameOfProperty == 'jdo.tck.dblist'}" >
+                            <j:new var="tempcfglist" className="java.lang.StringBuffer" />
+                            <j:set var="tempVar" value="${jdo.tck.cfglist}" />
+                            <j:forEach var='cfglistitem' items="${tempVar.iterator()}">
+                                <j:set var="foo" value='${tempcfglist.append(cfglistitem).append(" ")}' />
+                            </j:forEach>
+                            <j:set var="jdo.tck.cfglist" value="${tempcfglist}" /> 
+                            <j:new var="tempidentitytypes" className="java.lang.StringBuffer" />
+                            <j:set var="tempVar" value="${jdo.tck.identitytypes}" />
+                            <j:forEach var='identitytypesitem' items="${tempVar.iterator()}">
+                                <j:set var="foo" value='${tempidentitytypes.append(identitytypesitem).append(" ")}' />
+                            </j:forEach>
+                            <j:set var="jdo.tck.identitytypes" value="${tempidentitytypes}" />                         
+                        </j:when>
+                        <j:when test="${nameOfProperty == 'jdo.tck.identitytypes'}" >
+                            <j:new var="tempcfglist" className="java.lang.StringBuffer" />
+                            <j:set var="tempVar" value="${jdo.tck.cfglist}" />
+                            <j:forEach var='cfglistitem' items="${tempVar.iterator()}">
+                                <j:set var="foo" value='${tempcfglist.append(cfglistitem).append(" ")}' />
+                            </j:forEach>
+                            <j:set var="jdo.tck.cfglist" value="${tempcfglist}" />     
+                            <j:new var="tempdblist" className="java.lang.StringBuffer" />
+                            <j:set var="tempVar" value="${jdo.tck.dblist}" />
+                            <j:forEach var='dblistitem' items="${tempVar.iterator()}">
+                                <j:set var="foo" value='${tempdblist.append(dblistitem).append(" ")}' />
+                            </j:forEach>
+                            <j:set var="jdo.tck.dblist" value="${tempdblist}" />                                             
+                        </j:when>                       
+                        <j:otherwise >
+                            <j:new var="tempcfglist" className="java.lang.StringBuffer" />
+                            <j:set var="tempVar" value="${jdo.tck.cfglist}" />
+                            <j:forEach var='cfglistitem' items="${tempVar.iterator()}">
+                                <j:set var="foo" value='${tempcfglist.append(cfglistitem).append(" ")}' />
+                            </j:forEach>
+                            <j:set var="jdo.tck.cfglist" value="${tempcfglist}" /> 
+                            <j:new var="tempidentitytypes" className="java.lang.StringBuffer" />
+                            <j:set var="tempVar" value="${jdo.tck.identitytypes}" />
+                            <j:forEach var='identitytypesitem' items="${tempVar.iterator()}">
+                                <j:set var="foo" value='${tempidentitytypes.append(identitytypesitem).append(" ")}' />
+                            </j:forEach>
+                            <j:set var="jdo.tck.identitytypes" value="${tempidentitytypes}" /> 
+                            <j:new var="tempdblist" className="java.lang.StringBuffer" />
+                            <j:set var="tempVar" value="${jdo.tck.dblist}" />
+                            <j:forEach var='dblistitem' items="${tempVar.iterator()}">
+                                <j:set var="foo" value='${tempdblist.append(dblistitem).append(" ")}' />
+                            </j:forEach>
+                            <j:set var="jdo.tck.dblist" value="${tempdblist}" />                           
+                         </j:otherwise>
+                   </j:choose>
+                 </j:if>
+           </j:if>
+        </j:if>
+        <j:set var="propertySetUsingConsole" value="false" />
+    </preGoal>
+
     <goal name="setProps">
         <echo>setProps:</echo>
-
+        <j:set var='ranSetPropsOnce' value='true' />
         <j:set var="zeroval" value="0"/>
         <j:set var="spaceval" value=" "/>
         <j:set var="nullval" value=""/>

Reply via email to