[gant-scm] [jira] Created: (GANT-108) Handling MarkupBuilder 'yield' keyword

View: New views
20 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 | Next >

[gant-scm] [jira] Created: (GANT-108) Handling MarkupBuilder 'yield' keyword

by JIRA jira@codehaus.org :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

Handling MarkupBuilder 'yield' keyword
--------------------------------------

                 Key: GANT-108
                 URL: http://jira.codehaus.org/browse/GANT-108
             Project: Gant
          Issue Type: Bug
    Affects Versions: 1.8.1
         Environment: Groovy 1.6.5
            Reporter: MSJ


On only Groovy is OK.

if a following target or method invoked in a Gant script:
--
// variable 'projectName' is defined in a properties file and loaded. (i.e. "projectName=projectName")

def getMarkup() {
        def writer = new StringWriter()
        writer.write(
'''<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
''')
        def xml = new MarkupBuilder(writer)
        xml.Configure(class: "org.mortbay.jetty.webapp.WebAppContext") {
                Set(name: "contextPath", "/$projectName")
                Set(name: "war") {
                        SystemProperty(name: "jetty.home", default:".")
                        yield "/webapps/$projectName"
                }
                Set(name: "defaultDescriptor") {
                        SystemProperty(name: "jetty.home", default: ".")
                        yield '/etc/webapps/webdefault.xml'
                }
        }
        writer.toString()
}
--

output is this:
--
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure class='org.mortbay.jetty.webapp.WebAppContext'>
  <Set name='contextPath'>/projectName</Set>/webapps/projectName
  <Set name='war'>
    <SystemProperty name='jetty.home' default='.' />/webapps/projectName
  </Set>/etc/webapps/webdefault.xml
  <Set name='defaultDescriptor'>
    <SystemProperty name='jetty.home' default='.' />/etc/webapps/webdefault.xml
  </Set>
</Configure>
--

unneeded text is appended just after some </Set>.
When invoking the script as a Gant target,
the text is repeated 3 times.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

<hr/>
<p>
To unsubscribe from this list please visit:
</p>
<p>
    <a href="http://xircles.codehaus.org/manage_email">http://xircles.codehaus.org/manage_email</a>


[gant-scm] [jira] Commented: (GANT-108) Handling MarkupBuilder 'yield' keyword

by JIRA jira@codehaus.org :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/GANT-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=196091#action_196091 ]

Russel Winder commented on GANT-108:
------------------------------------

I am currently tempted to think this is a problem with the yield you have in the code rather than a Gant thing.  The code:
{code}
#! /usr/bin/env groovy

import groovy.xml.MarkupBuilder

projectName = 'blahBlah'

def getMarkup ( ) {
  def writer = new StringWriter ( )
  writer.write ( '''
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
''' )
  def xml = new MarkupBuilder ( writer )
  xml.Configure ( class : 'org.mortbay.jetty.webapp.WebAppContext' ) {
    Set ( name : 'contextPath' , "/$projectName" )
    //Set ( name : 'war' ) { SystemProperty ( name : 'jetty.home' , default : '.' ) yield "/webapps/$projectName" }
    //Set ( name : 'defaultDescriptor' ) { SystemProperty ( name : 'jetty.home' , default : '.' ) yield '/etc/webapps/webdefault.xml' }
  }
  writer.toString ( )
}

println ( getMarkup ( ) )
{code}
executes as a Groovy script thus:
{quote}
> groovy GANT_108.groovy

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure class='org.mortbay.jetty.webapp.WebAppContext'>
  <Set name='contextPath'>/blahBlah</Set>
</Configure>
506 balin:~/Progs/OddsByLanguage/Gant
>
{quote}
whereas the Gant script:
{code}
#! /usr/bin/env groovy

import groovy.xml.MarkupBuilder

projectName = 'blahBlah'

def getMarkup ( ) {
  def writer = new StringWriter ( )
  writer.write ( '''
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
''' )
  def xml = new MarkupBuilder ( writer )
  xml.Configure ( class : 'org.mortbay.jetty.webapp.WebAppContext' ) {
    Set ( name : 'contextPath' , "/$projectName" )
    //Set ( name : 'war' ) { SystemProperty ( name : 'jetty.home' , default : '.' ) yield "/webapps/$projectName" }
    //Set ( name : 'defaultDescriptor' ) { SystemProperty ( name : 'jetty.home' , default : '.' ) yield '/etc/webapps/webdefault.xml' }
  }
  writer.toString ( )
}

target ( 'default' : '' ) {
  println ( getMarkup ( ) )
}
{code}
executes as a Gant script thus:
{quote}
> gant -f GANT_108.gant
default:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure class='org.mortbay.jetty.webapp.WebAppContext'>
  <Set name='contextPath'>/blahBlah</Set>
</Configure>
------ default

BUILD SUCCESSFUL
Total time: 2.28 seconds
>
{quote}
which basically seems fine.

Now if I remove the comments from the two lines with yields in:
{quote}
> groovy GANT_108.groovy
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
/home/users/russel/Progs/OddsByLanguage/Gant/GANT_108.groovy: 16: expecting '}', found '/webapps/' @ line 16, column 89.
   home' , default : '.' ) yield "/webapps/
                                 ^

1 error

>
{quote}


> Handling MarkupBuilder 'yield' keyword
> --------------------------------------
>
>                 Key: GANT-108
>                 URL: http://jira.codehaus.org/browse/GANT-108
>             Project: Gant
>          Issue Type: Bug
>    Affects Versions: 1.8.1
>         Environment: Groovy 1.6.5
>            Reporter: MSJ
>
> On only Groovy is OK.
> if a following target or method invoked in a Gant script:
> --
> // variable 'projectName' is defined in a properties file and loaded. (i.e. "projectName=projectName")
> def getMarkup() {
> def writer = new StringWriter()
> writer.write(
> '''<?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> ''')
> def xml = new MarkupBuilder(writer)
> xml.Configure(class: "org.mortbay.jetty.webapp.WebAppContext") {
> Set(name: "contextPath", "/$projectName")
> Set(name: "war") {
> SystemProperty(name: "jetty.home", default:".")
> yield "/webapps/$projectName"
> }
> Set(name: "defaultDescriptor") {
> SystemProperty(name: "jetty.home", default: ".")
> yield '/etc/webapps/webdefault.xml'
> }
> }
> writer.toString()
> }
> --
> output is this:
> --
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> <Configure class='org.mortbay.jetty.webapp.WebAppContext'>
>   <Set name='contextPath'>/projectName</Set>/webapps/projectName
>   <Set name='war'>
>     <SystemProperty name='jetty.home' default='.' />/webapps/projectName
>   </Set>/etc/webapps/webdefault.xml
>   <Set name='defaultDescriptor'>
>     <SystemProperty name='jetty.home' default='.' />/etc/webapps/webdefault.xml
>   </Set>
> </Configure>
> --
> unneeded text is appended just after some </Set>.
> When invoking the script as a Gant target,
> the text is repeated 3 times.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

<hr/>
<p>
To unsubscribe from this list please visit:
</p>
<p>
    <a href="http://xircles.codehaus.org/manage_email">http://xircles.codehaus.org/manage_email</a>


[gant-scm] [jira] Commented: (GANT-108) Handling MarkupBuilder 'yield' keyword

by JIRA jira@codehaus.org :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/GANT-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=196141#action_196141 ]

MSJ commented on GANT-108:
--------------------------

I am sorry for inconvenience excerpt. And thank you for reviewing.
I also attached the excerpt (can be ran) file.

{code}
import groovy.xml.MarkupBuilder

projectName = 'blahBlah'

def getMarkup() {
        def writer = new StringWriter()
        writer.write(
'''<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
''')
        def xml = new MarkupBuilder(writer)
        xml.Configure(class: "org.mortbay.jetty.webapp.WebAppContext") {
                Set(name: "contextPath", "/$projectName")
                Set(name: "war") {
                        SystemProperty(name: "jetty.home", default:".")
                        yield "/webapps/$projectName"
                }
                Set(name: "defaultsDescriptor") {
                        SystemProperty(name: "jetty.home", default: ".")
                        yield '/etc/webdefault.xml'
                }
        }
        writer.toString()
}

target('getMarkup': '') {
        def writer = new StringWriter()
        writer.write(
'''<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
''')
        def xml = new MarkupBuilder(writer)
        xml.Configure(class: "org.mortbay.jetty.webapp.WebAppContext") {
                Set(name: "contextPath", "/$projectName")
                Set(name: "war") {
                        SystemProperty(name: "jetty.home", default:".")
                        yield "/webapps/$projectName"
                }
                Set(name: "defaultsDescriptor") {
                        SystemProperty(name: "jetty.home", default: ".")
                        yield '/etc/webdefault.xml'
                }
        }
        println writer.toString()
}

target('default': '') {
  println(getMarkup())
}
{code}
The original code was like above.

{code}
> gant
default:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure class='org.mortbay.jetty.webapp.WebAppContext'>
  <Set name='contextPath'>/blahBlah</Set>/webapps/blahBlah
  <Set name='war'>
    <SystemProperty name='jetty.home' default='.' />/webapps/blahBlah
  </Set>/etc/webdefault.xml
  <Set name='defaultsDescriptor'>
    <SystemProperty name='jetty.home' default='.' />/etc/webdefault.xml
  </Set>
</Configure>
------ default

BUILD SUCCESSFUL
{code}

{code}
> gant getMarkup
getMarkup:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure class='org.mortbay.jetty.webapp.WebAppContext'>
  <Set name='contextPath'>/blahBlah</Set>/webapps/blahBlah/webapps/blahBlah/webapps/blahBlah
  <Set name='war'>
    <SystemProperty name='jetty.home' default='.' />/webapps/blahBlah
  </Set>/etc/webdefault.xml/etc/webdefault.xml/etc/webdefault.xml
  <Set name='defaultsDescriptor'>
    <SystemProperty name='jetty.home' default='.' />/etc/webdefault.xml
  </Set>
</Configure>
------ getMarkup

BUILD SUCCESSFUL
{code}

> Handling MarkupBuilder 'yield' keyword
> --------------------------------------
>
>                 Key: GANT-108
>                 URL: http://jira.codehaus.org/browse/GANT-108
>             Project: Gant
>          Issue Type: Bug
>    Affects Versions: 1.8.1
>         Environment: Groovy 1.6.5
>            Reporter: MSJ
>
> On only Groovy is OK.
> if a following target or method invoked in a Gant script:
> --
> // variable 'projectName' is defined in a properties file and loaded. (i.e. "projectName=projectName")
> def getMarkup() {
> def writer = new StringWriter()
> writer.write(
> '''<?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> ''')
> def xml = new MarkupBuilder(writer)
> xml.Configure(class: "org.mortbay.jetty.webapp.WebAppContext") {
> Set(name: "contextPath", "/$projectName")
> Set(name: "war") {
> SystemProperty(name: "jetty.home", default:".")
> yield "/webapps/$projectName"
> }
> Set(name: "defaultDescriptor") {
> SystemProperty(name: "jetty.home", default: ".")
> yield '/etc/webapps/webdefault.xml'
> }
> }
> writer.toString()
> }
> --
> output is this:
> --
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> <Configure class='org.mortbay.jetty.webapp.WebAppContext'>
>   <Set name='contextPath'>/projectName</Set>/webapps/projectName
>   <Set name='war'>
>     <SystemProperty name='jetty.home' default='.' />/webapps/projectName
>   </Set>/etc/webapps/webdefault.xml
>   <Set name='defaultDescriptor'>
>     <SystemProperty name='jetty.home' default='.' />/etc/webapps/webdefault.xml
>   </Set>
> </Configure>
> --
> unneeded text is appended just after some </Set>.
> When invoking the script as a Gant target,
> the text is repeated 3 times.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

<hr/>
<p>
To unsubscribe from this list please visit:
</p>
<p>
    <a href="http://xircles.codehaus.org/manage_email">http://xircles.codehaus.org/manage_email</a>


[gant-scm] [jira] Updated: (GANT-108) Handling MarkupBuilder 'yield' keyword

by JIRA jira@codehaus.org :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message


     [ http://jira.codehaus.org/browse/GANT-108?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

MSJ updated GANT-108:
---------------------

    Attachment: build.gant

> Handling MarkupBuilder 'yield' keyword
> --------------------------------------
>
>                 Key: GANT-108
>                 URL: http://jira.codehaus.org/browse/GANT-108
>             Project: Gant
>          Issue Type: Bug
>    Affects Versions: 1.8.1
>         Environment: Groovy 1.6.5
>            Reporter: MSJ
>         Attachments: build.gant
>
>
> On only Groovy is OK.
> if a following target or method invoked in a Gant script:
> --
> // variable 'projectName' is defined in a properties file and loaded. (i.e. "projectName=projectName")
> def getMarkup() {
> def writer = new StringWriter()
> writer.write(
> '''<?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> ''')
> def xml = new MarkupBuilder(writer)
> xml.Configure(class: "org.mortbay.jetty.webapp.WebAppContext") {
> Set(name: "contextPath", "/$projectName")
> Set(name: "war") {
> SystemProperty(name: "jetty.home", default:".")
> yield "/webapps/$projectName"
> }
> Set(name: "defaultDescriptor") {
> SystemProperty(name: "jetty.home", default: ".")
> yield '/etc/webapps/webdefault.xml'
> }
> }
> writer.toString()
> }
> --
> output is this:
> --
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> <Configure class='org.mortbay.jetty.webapp.WebAppContext'>
>   <Set name='contextPath'>/projectName</Set>/webapps/projectName
>   <Set name='war'>
>     <SystemProperty name='jetty.home' default='.' />/webapps/projectName
>   </Set>/etc/webapps/webdefault.xml
>   <Set name='defaultDescriptor'>
>     <SystemProperty name='jetty.home' default='.' />/etc/webapps/webdefault.xml
>   </Set>
> </Configure>
> --
> unneeded text is appended just after some </Set>.
> When invoking the script as a Gant target,
> the text is repeated 3 times.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

<hr/>
<p>
To unsubscribe from this list please visit:
</p>
<p>
    <a href="http://xircles.codehaus.org/manage_email">http://xircles.codehaus.org/manage_email</a>


[gant-scm] [jira] Commented: (GANT-108) Handling MarkupBuilder 'yield' keyword

by JIRA jira@codehaus.org :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/GANT-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=196142#action_196142 ]

MSJ commented on GANT-108:
--------------------------

And in case Groovy ...

{code}
> groovyConsole
{code}

pasted this:
{code}
import groovy.xml.MarkupBuilder

projectName = 'blahBlah'

def getMarkup() {
    def writer = new StringWriter()
    writer.write(
'''<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
''')
    def xml = new MarkupBuilder(writer)
    xml.Configure(class: "org.mortbay.jetty.webapp.WebAppContext") {
        Set(name: "contextPath", "/$projectName")
        Set(name: "war") {
            SystemProperty(name: "jetty.home", default:".")
            yield "/webapps/$projectName"
        }
        Set(name: "defaultsDescriptor") {
            SystemProperty(name: "jetty.home", default: ".")
            yield '/etc/webdefault.xml'
        }
    }
    writer.toString()
}
getMarkup()
{code}

run:
{code}
Result: <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure class='org.mortbay.jetty.webapp.WebAppContext'>
  <Set name='contextPath'>/blahBlah</Set>
  <Set name='war'>
    <SystemProperty name='jetty.home' default='.' />/webapps/blahBlah
  </Set>
  <Set name='defaultsDescriptor'>
    <SystemProperty name='jetty.home' default='.' />/etc/webdefault.xml
  </Set>
</Configure>
{code}

> Handling MarkupBuilder 'yield' keyword
> --------------------------------------
>
>                 Key: GANT-108
>                 URL: http://jira.codehaus.org/browse/GANT-108
>             Project: Gant
>          Issue Type: Bug
>    Affects Versions: 1.8.1
>         Environment: Groovy 1.6.5
>            Reporter: MSJ
>         Attachments: build.gant
>
>
> On only Groovy is OK.
> if a following target or method invoked in a Gant script:
> --
> // variable 'projectName' is defined in a properties file and loaded. (i.e. "projectName=projectName")
> def getMarkup() {
> def writer = new StringWriter()
> writer.write(
> '''<?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> ''')
> def xml = new MarkupBuilder(writer)
> xml.Configure(class: "org.mortbay.jetty.webapp.WebAppContext") {
> Set(name: "contextPath", "/$projectName")
> Set(name: "war") {
> SystemProperty(name: "jetty.home", default:".")
> yield "/webapps/$projectName"
> }
> Set(name: "defaultDescriptor") {
> SystemProperty(name: "jetty.home", default: ".")
> yield '/etc/webapps/webdefault.xml'
> }
> }
> writer.toString()
> }
> --
> output is this:
> --
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> <Configure class='org.mortbay.jetty.webapp.WebAppContext'>
>   <Set name='contextPath'>/projectName</Set>/webapps/projectName
>   <Set name='war'>
>     <SystemProperty name='jetty.home' default='.' />/webapps/projectName
>   </Set>/etc/webapps/webdefault.xml
>   <Set name='defaultDescriptor'>
>     <SystemProperty name='jetty.home' default='.' />/etc/webapps/webdefault.xml
>   </Set>
> </Configure>
> --
> unneeded text is appended just after some </Set>.
> When invoking the script as a Gant target,
> the text is repeated 3 times.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

<hr/>
<p>
To unsubscribe from this list please visit:
</p>
<p>
    <a href="http://xircles.codehaus.org/manage_email">http://xircles.codehaus.org/manage_email</a>


[gant-scm] [jira] Commented: (GANT-108) Handling MarkupBuilder 'yield' keyword

by JIRA jira@codehaus.org :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/GANT-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=196143#action_196143 ]

Russel Winder commented on GANT-108:
------------------------------------

I tried the Groovy script:
{code}
#! /usr/bin/env groovy

import groovy.xml.MarkupBuilder

projectName = 'blahBlah'

def getMarkup ( ) {
  def writer = new StringWriter ( )
  writer.write ( '''
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
''' )
  def xml = new MarkupBuilder ( writer )
  xml.Configure ( class : 'org.mortbay.jetty.webapp.WebAppContext' ) {
    Set ( name : 'contextPath' , "/$projectName" )
    Set ( name : 'war' ) {
      SystemProperty ( name : 'jetty.home' , default : '.' )
      yield "/webapps/$projectName"
    }
    Set ( name : 'defaultDescriptor' ) {
      SystemProperty ( name : 'jetty.home' , default : '.' )
      yield '/etc/webapps/webdefault.xml'
    }
  }
  writer.toString ( )
}

println ( getMarkup ( ) )
{code}
and it resulted in:
{quote}
> groovy GANT_108.groovy

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure class='org.mortbay.jetty.webapp.WebAppContext'>
  <Set name='contextPath'>/blahBlah</Set>
  <Set name='war'>
    <SystemProperty name='jetty.home' default='.' />
    <yield>/webapps/blahBlah</yield>
  </Set>
  <Set name='defaultDescriptor'>
    <SystemProperty name='jetty.home' default='.' />
    <yield>/etc/webapps/webdefault.xml</yield>
  </Set>
</Configure>
>
{quote}
I then tried the Gant script:
{code}
#! /usr/bin/env groovy

import groovy.xml.MarkupBuilder

projectName = 'blahBlah'

def getMarkup ( ) {
  def writer = new StringWriter ( )
  writer.write ( '''
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
''' )
  def xml = new MarkupBuilder ( writer )
  xml.Configure ( class : 'org.mortbay.jetty.webapp.WebAppContext' ) {
    Set ( name : 'contextPath' , "/$projectName" )
    Set ( name : 'war' ) {
      SystemProperty ( name : 'jetty.home' , default : '.' )
      yield "/webapps/$projectName"
    }
    Set ( name : 'defaultDescriptor' ) {
      SystemProperty ( name : 'jetty.home' , default : '.' )
      yield '/etc/webapps/webdefault.xml'
    }
  }
  writer.toString ( )
}

target ( 'default' : '' ) {
  println ( getMarkup ( ) )
}

target ( 'getMarkup' : '' ) {
  def writer = new StringWriter ( )
  writer.write ( '''
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
''')
  def xml = new MarkupBuilder ( writer )
  xml.Configure ( class : 'org.mortbay.jetty.webapp.WebAppContext' ) {
    Set ( name : 'contextPath' , "/$projectName" )
    Set ( name : 'war' ) {
      SystemProperty ( name : 'jetty.home' , default : '.' )
      yield "/webapps/$projectName"
    }
    Set ( name : 'defaultsDescriptor' ) {
      SystemProperty ( name : 'jetty.home' , default : '.' )
      yield '/etc/webdefault.xml'
    }
  }
  println ( writer.toString ( ) )
}
{code}
and it resulted in:
{quote}
> gant -f GANT_108.gant
default:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure class='org.mortbay.jetty.webapp.WebAppContext'>
  <Set name='contextPath'>/blahBlah</Set>
  <Set name='war'>
    <SystemProperty name='jetty.home' default='.' />
    <yield>/webapps/blahBlah</yield>
  </Set>
  <Set name='defaultDescriptor'>
    <SystemProperty name='jetty.home' default='.' />
    <yield>/etc/webapps/webdefault.xml</yield>
  </Set>
</Configure>
------ default

BUILD SUCCESSFUL
Total time: 2.18 seconds
> gant -f GANT_108.gant getMarkup
getMarkup:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure class='org.mortbay.jetty.webapp.WebAppContext'>
  <Set name='contextPath'>/blahBlah</Set>
  <Set name='war'>
    <SystemProperty name='jetty.home' default='.' />
    <yield>/webapps/blahBlah</yield>
  </Set>
  <Set name='defaultsDescriptor'>
    <SystemProperty name='jetty.home' default='.' />
    <yield>/etc/webdefault.xml</yield>
  </Set>
</Configure>
------ getMarkup

BUILD SUCCESSFUL
Total time: 2.19 seconds
>
{quote}
So I am wondering if this is a "it works for me" situation?

> Handling MarkupBuilder 'yield' keyword
> --------------------------------------
>
>                 Key: GANT-108
>                 URL: http://jira.codehaus.org/browse/GANT-108
>             Project: Gant
>          Issue Type: Bug
>    Affects Versions: 1.8.1
>         Environment: Groovy 1.6.5
>            Reporter: MSJ
>         Attachments: build.gant
>
>
> On only Groovy is OK.
> if a following target or method invoked in a Gant script:
> --
> // variable 'projectName' is defined in a properties file and loaded. (i.e. "projectName=projectName")
> def getMarkup() {
> def writer = new StringWriter()
> writer.write(
> '''<?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> ''')
> def xml = new MarkupBuilder(writer)
> xml.Configure(class: "org.mortbay.jetty.webapp.WebAppContext") {
> Set(name: "contextPath", "/$projectName")
> Set(name: "war") {
> SystemProperty(name: "jetty.home", default:".")
> yield "/webapps/$projectName"
> }
> Set(name: "defaultDescriptor") {
> SystemProperty(name: "jetty.home", default: ".")
> yield '/etc/webapps/webdefault.xml'
> }
> }
> writer.toString()
> }
> --
> output is this:
> --
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> <Configure class='org.mortbay.jetty.webapp.WebAppContext'>
>   <Set name='contextPath'>/projectName</Set>/webapps/projectName
>   <Set name='war'>
>     <SystemProperty name='jetty.home' default='.' />/webapps/projectName
>   </Set>/etc/webapps/webdefault.xml
>   <Set name='defaultDescriptor'>
>     <SystemProperty name='jetty.home' default='.' />/etc/webapps/webdefault.xml
>   </Set>
> </Configure>
> --
> unneeded text is appended just after some </Set>.
> When invoking the script as a Gant target,
> the text is repeated 3 times.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

<hr/>
<p>
To unsubscribe from this list please visit:
</p>
<p>
    <a href="http://xircles.codehaus.org/manage_email">http://xircles.codehaus.org/manage_email</a>


[gant-scm] [jira] Updated: (GANT-108) Handling MarkupBuilder 'yield' keyword

by JIRA jira@codehaus.org :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message


     [ http://jira.codehaus.org/browse/GANT-108?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

MSJ updated GANT-108:
---------------------

    Attachment: build.gant

'mkp.yield' version

> Handling MarkupBuilder 'yield' keyword
> --------------------------------------
>
>                 Key: GANT-108
>                 URL: http://jira.codehaus.org/browse/GANT-108
>             Project: Gant
>          Issue Type: Bug
>    Affects Versions: 1.8.1
>         Environment: Groovy 1.6.5
>            Reporter: MSJ
>         Attachments: build.gant, build.gant
>
>
> On only Groovy is OK.
> if a following target or method invoked in a Gant script:
> --
> // variable 'projectName' is defined in a properties file and loaded. (i.e. "projectName=projectName")
> def getMarkup() {
> def writer = new StringWriter()
> writer.write(
> '''<?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> ''')
> def xml = new MarkupBuilder(writer)
> xml.Configure(class: "org.mortbay.jetty.webapp.WebAppContext") {
> Set(name: "contextPath", "/$projectName")
> Set(name: "war") {
> SystemProperty(name: "jetty.home", default:".")
> yield "/webapps/$projectName"
> }
> Set(name: "defaultDescriptor") {
> SystemProperty(name: "jetty.home", default: ".")
> yield '/etc/webapps/webdefault.xml'
> }
> }
> writer.toString()
> }
> --
> output is this:
> --
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> <Configure class='org.mortbay.jetty.webapp.WebAppContext'>
>   <Set name='contextPath'>/projectName</Set>/webapps/projectName
>   <Set name='war'>
>     <SystemProperty name='jetty.home' default='.' />/webapps/projectName
>   </Set>/etc/webapps/webdefault.xml
>   <Set name='defaultDescriptor'>
>     <SystemProperty name='jetty.home' default='.' />/etc/webapps/webdefault.xml
>   </Set>
> </Configure>
> --
> unneeded text is appended just after some </Set>.
> When invoking the script as a Gant target,
> the text is repeated 3 times.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

<hr/>
<p>
To unsubscribe from this list please visit:
</p>
<p>
    <a href="http://xircles.codehaus.org/manage_email">http://xircles.codehaus.org/manage_email</a>


[gant-scm] [jira] Commented: (GANT-108) Handling MarkupBuilder 'yield' keyword

by JIRA jira@codehaus.org :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/GANT-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=196354#action_196354 ]

MSJ commented on GANT-108:
--------------------------

I don't know why 'yield' without 'mkp.' (thus isn't 'mkp.yield') works for me.
And this is the Groovy standard or not.

Anyway, 'yield' is for 'Prints data in the body of the current tag, escaping XML entities.' ([javadoc|http://groovy.codehaus.org/api/groovy/xml/MarkupBuilder.html#yield%28java.lang.String%29])
{code}
...
    <yield>/webapps/blahBlah</yield>
...
{code}
is not the expected result...

Could you try 'mkp.yield' version? (attached. listed as number 2.)

> Handling MarkupBuilder 'yield' keyword
> --------------------------------------
>
>                 Key: GANT-108
>                 URL: http://jira.codehaus.org/browse/GANT-108
>             Project: Gant
>          Issue Type: Bug
>    Affects Versions: 1.8.1
>         Environment: Groovy 1.6.5
>            Reporter: MSJ
>         Attachments: build.gant, build.gant
>
>
> On only Groovy is OK.
> if a following target or method invoked in a Gant script:
> --
> // variable 'projectName' is defined in a properties file and loaded. (i.e. "projectName=projectName")
> def getMarkup() {
> def writer = new StringWriter()
> writer.write(
> '''<?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> ''')
> def xml = new MarkupBuilder(writer)
> xml.Configure(class: "org.mortbay.jetty.webapp.WebAppContext") {
> Set(name: "contextPath", "/$projectName")
> Set(name: "war") {
> SystemProperty(name: "jetty.home", default:".")
> yield "/webapps/$projectName"
> }
> Set(name: "defaultDescriptor") {
> SystemProperty(name: "jetty.home", default: ".")
> yield '/etc/webapps/webdefault.xml'
> }
> }
> writer.toString()
> }
> --
> output is this:
> --
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> <Configure class='org.mortbay.jetty.webapp.WebAppContext'>
>   <Set name='contextPath'>/projectName</Set>/webapps/projectName
>   <Set name='war'>
>     <SystemProperty name='jetty.home' default='.' />/webapps/projectName
>   </Set>/etc/webapps/webdefault.xml
>   <Set name='defaultDescriptor'>
>     <SystemProperty name='jetty.home' default='.' />/etc/webapps/webdefault.xml
>   </Set>
> </Configure>
> --
> unneeded text is appended just after some </Set>.
> When invoking the script as a Gant target,
> the text is repeated 3 times.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

<hr/>
<p>
To unsubscribe from this list please visit:
</p>
<p>
    <a href="http://xircles.codehaus.org/manage_email">http://xircles.codehaus.org/manage_email</a>


[gant-scm] [jira] Commented: (GANT-108) Handling MarkupBuilder 'yield' keyword

by JIRA jira@codehaus.org :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/GANT-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=196355#action_196355 ]

MSJ commented on GANT-108:
--------------------------

> (... listed as number 2.)
NO,
(... listed as number 1.)
(newer date) is right.

> Handling MarkupBuilder 'yield' keyword
> --------------------------------------
>
>                 Key: GANT-108
>                 URL: http://jira.codehaus.org/browse/GANT-108
>             Project: Gant
>          Issue Type: Bug
>    Affects Versions: 1.8.1
>         Environment: Groovy 1.6.5
>            Reporter: MSJ
>         Attachments: build.gant, build.gant
>
>
> On only Groovy is OK.
> if a following target or method invoked in a Gant script:
> --
> // variable 'projectName' is defined in a properties file and loaded. (i.e. "projectName=projectName")
> def getMarkup() {
> def writer = new StringWriter()
> writer.write(
> '''<?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> ''')
> def xml = new MarkupBuilder(writer)
> xml.Configure(class: "org.mortbay.jetty.webapp.WebAppContext") {
> Set(name: "contextPath", "/$projectName")
> Set(name: "war") {
> SystemProperty(name: "jetty.home", default:".")
> yield "/webapps/$projectName"
> }
> Set(name: "defaultDescriptor") {
> SystemProperty(name: "jetty.home", default: ".")
> yield '/etc/webapps/webdefault.xml'
> }
> }
> writer.toString()
> }
> --
> output is this:
> --
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> <Configure class='org.mortbay.jetty.webapp.WebAppContext'>
>   <Set name='contextPath'>/projectName</Set>/webapps/projectName
>   <Set name='war'>
>     <SystemProperty name='jetty.home' default='.' />/webapps/projectName
>   </Set>/etc/webapps/webdefault.xml
>   <Set name='defaultDescriptor'>
>     <SystemProperty name='jetty.home' default='.' />/etc/webapps/webdefault.xml
>   </Set>
> </Configure>
> --
> unneeded text is appended just after some </Set>.
> When invoking the script as a Gant target,
> the text is repeated 3 times.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

<hr/>
<p>
To unsubscribe from this list please visit:
</p>
<p>
    <a href="http://xircles.codehaus.org/manage_email">http://xircles.codehaus.org/manage_email</a>


[gant-scm] [jira] Commented: (GANT-108) Handling MarkupBuilder 'yield' keyword

by JIRA jira@codehaus.org :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/GANT-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=196356#action_196356 ]

MSJ commented on GANT-108:
--------------------------

I tested  PC envs on primary (1st encountered the issue):
Windows Vista 64 bit, Java 1.6.0_16, Groovy 1.6.5, Ant 1.7.1, Gant 1.8.1
And also causes on:
WindowsXP 32, Java 1.6.0_15, Groovy 1.6.5, Ant 1.7.1, Gant 1.8.0

(I will prepare sanitized environment variables lists later...)

> Handling MarkupBuilder 'yield' keyword
> --------------------------------------
>
>                 Key: GANT-108
>                 URL: http://jira.codehaus.org/browse/GANT-108
>             Project: Gant
>          Issue Type: Bug
>    Affects Versions: 1.8.1
>         Environment: Groovy 1.6.5
>            Reporter: MSJ
>         Attachments: build.gant, build.gant
>
>
> On only Groovy is OK.
> if a following target or method invoked in a Gant script:
> --
> // variable 'projectName' is defined in a properties file and loaded. (i.e. "projectName=projectName")
> def getMarkup() {
> def writer = new StringWriter()
> writer.write(
> '''<?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> ''')
> def xml = new MarkupBuilder(writer)
> xml.Configure(class: "org.mortbay.jetty.webapp.WebAppContext") {
> Set(name: "contextPath", "/$projectName")
> Set(name: "war") {
> SystemProperty(name: "jetty.home", default:".")
> yield "/webapps/$projectName"
> }
> Set(name: "defaultDescriptor") {
> SystemProperty(name: "jetty.home", default: ".")
> yield '/etc/webapps/webdefault.xml'
> }
> }
> writer.toString()
> }
> --
> output is this:
> --
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> <Configure class='org.mortbay.jetty.webapp.WebAppContext'>
>   <Set name='contextPath'>/projectName</Set>/webapps/projectName
>   <Set name='war'>
>     <SystemProperty name='jetty.home' default='.' />/webapps/projectName
>   </Set>/etc/webapps/webdefault.xml
>   <Set name='defaultDescriptor'>
>     <SystemProperty name='jetty.home' default='.' />/etc/webapps/webdefault.xml
>   </Set>
> </Configure>
> --
> unneeded text is appended just after some </Set>.
> When invoking the script as a Gant target,
> the text is repeated 3 times.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

<hr/>
<p>
To unsubscribe from this list please visit:
</p>
<p>
    <a href="http://xircles.codehaus.org/manage_email">http://xircles.codehaus.org/manage_email</a>


[gant-scm] [jira] Commented: (GANT-108) Handling MarkupBuilder 'yield' keyword

by JIRA jira@codehaus.org :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/GANT-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=196385#action_196385 ]

Russel Winder commented on GANT-108:
------------------------------------

Tried with mkp.yield and as far as I can tell Gant and Groovy behave identically in all situations.  It all seems to be working as it should.

I am not sure what the problem is.  Sorry possibly my fault, but . . .



> Handling MarkupBuilder 'yield' keyword
> --------------------------------------
>
>                 Key: GANT-108
>                 URL: http://jira.codehaus.org/browse/GANT-108
>             Project: Gant
>          Issue Type: Bug
>    Affects Versions: 1.8.1
>         Environment: Groovy 1.6.5
>            Reporter: MSJ
>         Attachments: build.gant, build.gant
>
>
> On only Groovy is OK.
> if a following target or method invoked in a Gant script:
> --
> // variable 'projectName' is defined in a properties file and loaded. (i.e. "projectName=projectName")
> def getMarkup() {
> def writer = new StringWriter()
> writer.write(
> '''<?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> ''')
> def xml = new MarkupBuilder(writer)
> xml.Configure(class: "org.mortbay.jetty.webapp.WebAppContext") {
> Set(name: "contextPath", "/$projectName")
> Set(name: "war") {
> SystemProperty(name: "jetty.home", default:".")
> yield "/webapps/$projectName"
> }
> Set(name: "defaultDescriptor") {
> SystemProperty(name: "jetty.home", default: ".")
> yield '/etc/webapps/webdefault.xml'
> }
> }
> writer.toString()
> }
> --
> output is this:
> --
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> <Configure class='org.mortbay.jetty.webapp.WebAppContext'>
>   <Set name='contextPath'>/projectName</Set>/webapps/projectName
>   <Set name='war'>
>     <SystemProperty name='jetty.home' default='.' />/webapps/projectName
>   </Set>/etc/webapps/webdefault.xml
>   <Set name='defaultDescriptor'>
>     <SystemProperty name='jetty.home' default='.' />/etc/webapps/webdefault.xml
>   </Set>
> </Configure>
> --
> unneeded text is appended just after some </Set>.
> When invoking the script as a Gant target,
> the text is repeated 3 times.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

<hr/>
<p>
To unsubscribe from this list please visit:
</p>
<p>
    <a href="http://xircles.codehaus.org/manage_email">http://xircles.codehaus.org/manage_email</a>


[gant-scm] [jira] Commented: (GANT-108) Handling MarkupBuilder 'yield' keyword

by JIRA jira@codehaus.org :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/GANT-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=196407#action_196407 ]

MSJ commented on GANT-108:
--------------------------

Thank you anyway.
I'll test on the other OS and environments.

> Handling MarkupBuilder 'yield' keyword
> --------------------------------------
>
>                 Key: GANT-108
>                 URL: http://jira.codehaus.org/browse/GANT-108
>             Project: Gant
>          Issue Type: Bug
>    Affects Versions: 1.8.1
>         Environment: Groovy 1.6.5
>            Reporter: MSJ
>         Attachments: build.gant, build.gant
>
>
> On only Groovy is OK.
> if a following target or method invoked in a Gant script:
> --
> // variable 'projectName' is defined in a properties file and loaded. (i.e. "projectName=projectName")
> def getMarkup() {
> def writer = new StringWriter()
> writer.write(
> '''<?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> ''')
> def xml = new MarkupBuilder(writer)
> xml.Configure(class: "org.mortbay.jetty.webapp.WebAppContext") {
> Set(name: "contextPath", "/$projectName")
> Set(name: "war") {
> SystemProperty(name: "jetty.home", default:".")
> yield "/webapps/$projectName"
> }
> Set(name: "defaultDescriptor") {
> SystemProperty(name: "jetty.home", default: ".")
> yield '/etc/webapps/webdefault.xml'
> }
> }
> writer.toString()
> }
> --
> output is this:
> --
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> <Configure class='org.mortbay.jetty.webapp.WebAppContext'>
>   <Set name='contextPath'>/projectName</Set>/webapps/projectName
>   <Set name='war'>
>     <SystemProperty name='jetty.home' default='.' />/webapps/projectName
>   </Set>/etc/webapps/webdefault.xml
>   <Set name='defaultDescriptor'>
>     <SystemProperty name='jetty.home' default='.' />/etc/webapps/webdefault.xml
>   </Set>
> </Configure>
> --
> unneeded text is appended just after some </Set>.
> When invoking the script as a Gant target,
> the text is repeated 3 times.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

<hr/>
<p>
To unsubscribe from this list please visit:
</p>
<p>
    <a href="http://xircles.codehaus.org/manage_email">http://xircles.codehaus.org/manage_email</a>


[gant-scm] [jira] Commented: (GANT-108) Handling MarkupBuilder 'yield' keyword

by JIRA jira@codehaus.org :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/GANT-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=196411#action_196411 ]

Russel Winder commented on GANT-108:
------------------------------------

Hummm... it would help if I actually looked at the output properly.  The Gant execution is clearly outputting extra strings that should not be there.  Apologies for claiming there was no problem here, there clearly is.

It is interesting that using a function call in the target gives one erroneous extra version of the string, where putting the call directly in the target generates to copies of the erroneous extra string.  Another data point is that if the function is a function then you get only one copy of the erroneous extra string, whereas if it is a closure two copies are output.

There is clearly an interaction between the mkp.yield semantics and the Gant context, and the use of closures versus functions is an issue, which implies the binding may be a factor.

This is decidedly weird.

> Handling MarkupBuilder 'yield' keyword
> --------------------------------------
>
>                 Key: GANT-108
>                 URL: http://jira.codehaus.org/browse/GANT-108
>             Project: Gant
>          Issue Type: Bug
>    Affects Versions: 1.8.1
>         Environment: Groovy 1.6.5
>            Reporter: MSJ
>         Attachments: build.gant, build.gant
>
>
> On only Groovy is OK.
> if a following target or method invoked in a Gant script:
> --
> // variable 'projectName' is defined in a properties file and loaded. (i.e. "projectName=projectName")
> def getMarkup() {
> def writer = new StringWriter()
> writer.write(
> '''<?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> ''')
> def xml = new MarkupBuilder(writer)
> xml.Configure(class: "org.mortbay.jetty.webapp.WebAppContext") {
> Set(name: "contextPath", "/$projectName")
> Set(name: "war") {
> SystemProperty(name: "jetty.home", default:".")
> yield "/webapps/$projectName"
> }
> Set(name: "defaultDescriptor") {
> SystemProperty(name: "jetty.home", default: ".")
> yield '/etc/webapps/webdefault.xml'
> }
> }
> writer.toString()
> }
> --
> output is this:
> --
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> <Configure class='org.mortbay.jetty.webapp.WebAppContext'>
>   <Set name='contextPath'>/projectName</Set>/webapps/projectName
>   <Set name='war'>
>     <SystemProperty name='jetty.home' default='.' />/webapps/projectName
>   </Set>/etc/webapps/webdefault.xml
>   <Set name='defaultDescriptor'>
>     <SystemProperty name='jetty.home' default='.' />/etc/webapps/webdefault.xml
>   </Set>
> </Configure>
> --
> unneeded text is appended just after some </Set>.
> When invoking the script as a Gant target,
> the text is repeated 3 times.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

<hr/>
<p>
To unsubscribe from this list please visit:
</p>
<p>
    <a href="http://xircles.codehaus.org/manage_email">http://xircles.codehaus.org/manage_email</a>


[gant-scm] [jira] Commented: (GANT-108) Handling MarkupBuilder 'yield' keyword

by JIRA jira@codehaus.org :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/GANT-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=196417#action_196417 ]

Russel Winder commented on GANT-108:
------------------------------------

I am at a complete loss as to what to do about this :-(

In a file getMarkup.groovy I have:
{code}
import groovy.xml.MarkupBuilder

projectName = 'blahBlah'

getMarkup = {
  def writer = new StringWriter ( )
  writer.write ( '''
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
''' )
  def xml = new MarkupBuilder ( writer )
  xml.Configure ( class : 'org.mortbay.jetty.webapp.WebAppContext' ) {

    println ( 'ZZZZ' )

    Set ( name : 'contextPath' , "/$projectName" )
    Set ( name : 'war' ) {
      SystemProperty ( name : 'jetty.home' , default : '.' )

      println ( 'WWWW' )

      mkp.yield "/webapps/$projectName"
    }
    Set ( name : 'defaultDescriptor' ) {
      SystemProperty ( name : 'jetty.home' , default : '.' )

      println ( 'XXXX' )

      mkp.yield '/etc/webapps/webdefault.xml'
    }
  }
  println ( writer.toString ( ) )
}
{code}
In alt_1.gant I have:
{code}
evaluate ( ( new File ( 'getMarkup.groovy' ) ).text )
target ( 'default' : '' ) { getMarkup ( ) }
{code}
Running this gives:
{quote}
> gant -f alt_1.gant
default:
ZZZZ
WWWW
XXXX

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure class='org.mortbay.jetty.webapp.WebAppContext'>
  <Set name='contextPath'>/blahBlah</Set>
  <Set name='war'>
    <SystemProperty name='jetty.home' default='.' />/webapps/blahBlah
  </Set>
  <Set name='defaultDescriptor'>
    <SystemProperty name='jetty.home' default='.' />/etc/webapps/webdefault.xml
  </Set>
</Configure>
------ default

BUILD SUCCESSFUL
Total time: 2.10 seconds
>
{quote}
which is success -- the output is what it should be with no extra bits and pieces.  However, the file alt_2.gant:
{code}
import groovy.xml.MarkupBuilder

target ( 'default' : '' ) {
  projectName = 'blahBlah'
  def writer = new StringWriter ( )
  writer.write ( '''
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
''' )
  def xml = new MarkupBuilder ( writer )
  xml.Configure ( class : 'org.mortbay.jetty.webapp.WebAppContext' ) {
   
    println ( 'ZZZZ' )
   
    Set ( name : 'contextPath' , "/$projectName" )
    Set ( name : 'war' ) {
      SystemProperty ( name : 'jetty.home' , default : '.' )
     
      println ( 'WWWW' )
     
      mkp.yield "/webapps/$projectName"
    }
    Set ( name : 'defaultDescriptor' ) {
      SystemProperty ( name : 'jetty.home' , default : '.' )
     
      println ( 'XXXX' )
     
      mkp.yield '/etc/webapps/webdefault.xml'
    }
  }
  println ( writer.toString ( ) )
}
{code}
when executed gives us:
{quote}
> gant -f alt_2.gant
default:
ZZZZ
WWWW
WWWW
WWWW
XXXX
XXXX
XXXX

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure class='org.mortbay.jetty.webapp.WebAppContext'>
  <Set name='contextPath'>/blahBlah</Set>/webapps/blahBlah/webapps/blahBlah
  <Set name='war'>
    <SystemProperty name='jetty.home' default='.' />/webapps/blahBlah
  </Set>/etc/webapps/webdefault.xml/etc/webapps/webdefault.xml
  <Set name='defaultDescriptor'>
    <SystemProperty name='jetty.home' default='.' />/etc/webapps/webdefault.xml
  </Set>
</Configure>
------ default

BUILD SUCCESSFUL
Total time: 2.06 seconds
>
{quote}
which shows the closuire being executed three times instead of once.  The file alt_3.gant:
{code}
import groovy.xml.MarkupBuilder

projectName = 'blahBlah'

getMarkup = {
  def writer = new StringWriter ( )
  writer.write ( '''
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
''' )
  def xml = new MarkupBuilder ( writer )
  xml.Configure ( class : 'org.mortbay.jetty.webapp.WebAppContext' ) {

    println ( 'ZZZZ' )

    Set ( name : 'contextPath' , "/$projectName" )
    Set ( name : 'war' ) {
      SystemProperty ( name : 'jetty.home' , default : '.' )

      println ( 'WWWW' )

      mkp.yield "/webapps/$projectName"
    }
    Set ( name : 'defaultDescriptor' ) {
      SystemProperty ( name : 'jetty.home' , default : '.' )

      println ( 'XXXX' )

      mkp.yield '/etc/webapps/webdefault.xml'
    }
  }
  println ( writer.toString ( ) )
}

target ( 'default' : '' ) { getMarkup ( ) }
{code}
when executed gives:
{quote}
> gant -f alt_3.gant
default:
ZZZZ
WWWW
WWWW
XXXX
XXXX

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure class='org.mortbay.jetty.webapp.WebAppContext'>
  <Set name='contextPath'>/blahBlah</Set>/webapps/blahBlah
  <Set name='war'>
    <SystemProperty name='jetty.home' default='.' />/webapps/blahBlah
  </Set>/etc/webapps/webdefault.xml
  <Set name='defaultDescriptor'>
    <SystemProperty name='jetty.home' default='.' />/etc/webapps/webdefault.xml
  </Set>
</Configure>
------ default

BUILD SUCCESSFUL
Total time: 2.31 seconds
>
{quote}
showing the closures being executed twice.

So the problem is not the mkp.yield per se that is the problem, it is that the closure is being executed multiple times, the count of which is dependent on the context.

> Handling MarkupBuilder 'yield' keyword
> --------------------------------------
>
>                 Key: GANT-108
>                 URL: http://jira.codehaus.org/browse/GANT-108
>             Project: Gant
>          Issue Type: Bug
>    Affects Versions: 1.8.1
>         Environment: Groovy 1.6.5
>            Reporter: MSJ
>         Attachments: build.gant, build.gant
>
>
> On only Groovy is OK.
> if a following target or method invoked in a Gant script:
> --
> // variable 'projectName' is defined in a properties file and loaded. (i.e. "projectName=projectName")
> def getMarkup() {
> def writer = new StringWriter()
> writer.write(
> '''<?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> ''')
> def xml = new MarkupBuilder(writer)
> xml.Configure(class: "org.mortbay.jetty.webapp.WebAppContext") {
> Set(name: "contextPath", "/$projectName")
> Set(name: "war") {
> SystemProperty(name: "jetty.home", default:".")
> yield "/webapps/$projectName"
> }
> Set(name: "defaultDescriptor") {
> SystemProperty(name: "jetty.home", default: ".")
> yield '/etc/webapps/webdefault.xml'
> }
> }
> writer.toString()
> }
> --
> output is this:
> --
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> <Configure class='org.mortbay.jetty.webapp.WebAppContext'>
>   <Set name='contextPath'>/projectName</Set>/webapps/projectName
>   <Set name='war'>
>     <SystemProperty name='jetty.home' default='.' />/webapps/projectName
>   </Set>/etc/webapps/webdefault.xml
>   <Set name='defaultDescriptor'>
>     <SystemProperty name='jetty.home' default='.' />/etc/webapps/webdefault.xml
>   </Set>
> </Configure>
> --
> unneeded text is appended just after some </Set>.
> When invoking the script as a Gant target,
> the text is repeated 3 times.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

<hr/>
<p>
To unsubscribe from this list please visit:
</p>
<p>
    <a href="http://xircles.codehaus.org/manage_email">http://xircles.codehaus.org/manage_email</a>


[gant-scm] [jira] Commented: (GANT-108) Handling MarkupBuilder 'yield' keyword

by JIRA jira@codehaus.org :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/GANT-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=196505#action_196505 ]

MSJ commented on GANT-108:
--------------------------

I remember that the MarkupBuilder in this case is in a Builder already (is this right?).
I tried to add the 'xml.' prefixes to the methods in the MarkupBuilder.
{code}
...
        def xml = new MarkupBuilder(writer)
        xml.Configure(class: "org.mortbay.jetty.webapp.WebAppContext") {
                xml.Set(name: "contextPath", "/$projectName")
                xml.Set(name: "war") {
                        xml.SystemProperty(name: "jetty.home", default:".")
                        xml.mkp.yield "/webapps/$projectName"
                }
                xml.Set(name: "defaultsDescriptor") {
                        xml.SystemProperty(name: "jetty.home", default: ".")
                        xml.mkp.yield "/etc/webdefault.xml"
                }
        }
...
{code}
this properly did output the expected code:
{code}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure class='org.mortbay.jetty.webapp.WebAppContext'>
  <Set name='contextPath'>/blahBlah</Set>
  <Set name='war'>
    <SystemProperty name='jetty.home' default='.' />/webapps/blahBlah
  </Set>
  <Set name='defaultsDescriptor'>
    <SystemProperty name='jetty.home' default='.' />/etc/webdefault.xml
  </Set>
</Configure>
{code}

And me also, removes 'xml.' prefixes in order,
found that the 'Set' elements only need the prefixes.

result workaround is this:
{code}
...
        def xml = new MarkupBuilder(writer)
        xml.Configure(class: "org.mortbay.jetty.webapp.WebAppContext") {
                xml.Set(name: "contextPath", "/$projectName")
                xml.Set(name: "war") {
                        SystemProperty(name: "jetty.home", default:".")
                        mkp.yield "/webapps/$projectName"
                }
                xml.Set(name: "defaultsDescriptor") {
                        SystemProperty(name: "jetty.home", default: ".")
                        mkp.yield "/etc/webdefault.xml"
                }
        }
...
{code}

Is there 'Set' builder method confliction?

> Handling MarkupBuilder 'yield' keyword
> --------------------------------------
>
>                 Key: GANT-108
>                 URL: http://jira.codehaus.org/browse/GANT-108
>             Project: Gant
>          Issue Type: Bug
>    Affects Versions: 1.8.1
>         Environment: Groovy 1.6.5
>            Reporter: MSJ
>         Attachments: build.gant, build.gant
>
>
> On only Groovy is OK.
> if a following target or method invoked in a Gant script:
> --
> // variable 'projectName' is defined in a properties file and loaded. (i.e. "projectName=projectName")
> def getMarkup() {
> def writer = new StringWriter()
> writer.write(
> '''<?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> ''')
> def xml = new MarkupBuilder(writer)
> xml.Configure(class: "org.mortbay.jetty.webapp.WebAppContext") {
> Set(name: "contextPath", "/$projectName")
> Set(name: "war") {
> SystemProperty(name: "jetty.home", default:".")
> yield "/webapps/$projectName"
> }
> Set(name: "defaultDescriptor") {
> SystemProperty(name: "jetty.home", default: ".")
> yield '/etc/webapps/webdefault.xml'
> }
> }
> writer.toString()
> }
> --
> output is this:
> --
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> <Configure class='org.mortbay.jetty.webapp.WebAppContext'>
>   <Set name='contextPath'>/projectName</Set>/webapps/projectName
>   <Set name='war'>
>     <SystemProperty name='jetty.home' default='.' />/webapps/projectName
>   </Set>/etc/webapps/webdefault.xml
>   <Set name='defaultDescriptor'>
>     <SystemProperty name='jetty.home' default='.' />/etc/webapps/webdefault.xml
>   </Set>
> </Configure>
> --
> unneeded text is appended just after some </Set>.
> When invoking the script as a Gant target,
> the text is repeated 3 times.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

<hr/>
<p>
To unsubscribe from this list please visit:
</p>
<p>
    <a href="http://xircles.codehaus.org/manage_email">http://xircles.codehaus.org/manage_email</a>


[gant-scm] [jira] Commented: (GANT-108) Handling MarkupBuilder 'yield' keyword

by JIRA jira@codehaus.org :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/GANT-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=196506#action_196506 ]

MSJ commented on GANT-108:
--------------------------

So, I also can say "this is not yield keyword specific problem".
Thank you for reviewing.

> Handling MarkupBuilder 'yield' keyword
> --------------------------------------
>
>                 Key: GANT-108
>                 URL: http://jira.codehaus.org/browse/GANT-108
>             Project: Gant
>          Issue Type: Bug
>    Affects Versions: 1.8.1
>         Environment: Groovy 1.6.5
>            Reporter: MSJ
>         Attachments: build.gant, build.gant
>
>
> On only Groovy is OK.
> if a following target or method invoked in a Gant script:
> --
> // variable 'projectName' is defined in a properties file and loaded. (i.e. "projectName=projectName")
> def getMarkup() {
> def writer = new StringWriter()
> writer.write(
> '''<?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> ''')
> def xml = new MarkupBuilder(writer)
> xml.Configure(class: "org.mortbay.jetty.webapp.WebAppContext") {
> Set(name: "contextPath", "/$projectName")
> Set(name: "war") {
> SystemProperty(name: "jetty.home", default:".")
> yield "/webapps/$projectName"
> }
> Set(name: "defaultDescriptor") {
> SystemProperty(name: "jetty.home", default: ".")
> yield '/etc/webapps/webdefault.xml'
> }
> }
> writer.toString()
> }
> --
> output is this:
> --
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> <Configure class='org.mortbay.jetty.webapp.WebAppContext'>
>   <Set name='contextPath'>/projectName</Set>/webapps/projectName
>   <Set name='war'>
>     <SystemProperty name='jetty.home' default='.' />/webapps/projectName
>   </Set>/etc/webapps/webdefault.xml
>   <Set name='defaultDescriptor'>
>     <SystemProperty name='jetty.home' default='.' />/etc/webapps/webdefault.xml
>   </Set>
> </Configure>
> --
> unneeded text is appended just after some </Set>.
> When invoking the script as a Gant target,
> the text is repeated 3 times.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

<hr/>
<p>
To unsubscribe from this list please visit:
</p>
<p>
    <a href="http://xircles.codehaus.org/manage_email">http://xircles.codehaus.org/manage_email</a>


[gant-scm] [jira] Commented: (GANT-108) Handling MarkupBuilder 'yield' keyword

by JIRA jira@codehaus.org :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/GANT-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=196529#action_196529 ]

Russel Winder commented on GANT-108:
------------------------------------

Stripping it down to the bare essentials, we have the question:  Why does:
{code}
import groovy.xml.MarkupBuilder

target ( 'default' : '' ) {
  def writer = new StringWriter ( )
  def xml = new MarkupBuilder ( writer )
  xml.Configure {
    Set { println ( 'Hello' ) }
  }
  println ( writer.toString ( ) )
}
{code}
result in the output:
{quote}
> gant -f alt_2.gant
default:
Hello
Hello
Hello
<Configure>
  <Set />
</Configure>
------ default

BUILD SUCCESSFUL
Total time: 1.98 seconds
>
{quote}
i.e. three executions of the output of Hello.  Contrast this with explicitly putting the xml on the Set -- which should be unnecessary -- which outputs just a single Hello.

It just seems weird that the closure body gets executed three times.

> Handling MarkupBuilder 'yield' keyword
> --------------------------------------
>
>                 Key: GANT-108
>                 URL: http://jira.codehaus.org/browse/GANT-108
>             Project: Gant
>          Issue Type: Bug
>    Affects Versions: 1.8.1
>         Environment: Groovy 1.6.5
>            Reporter: MSJ
>         Attachments: build.gant, build.gant
>
>
> On only Groovy is OK.
> if a following target or method invoked in a Gant script:
> --
> // variable 'projectName' is defined in a properties file and loaded. (i.e. "projectName=projectName")
> def getMarkup() {
> def writer = new StringWriter()
> writer.write(
> '''<?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> ''')
> def xml = new MarkupBuilder(writer)
> xml.Configure(class: "org.mortbay.jetty.webapp.WebAppContext") {
> Set(name: "contextPath", "/$projectName")
> Set(name: "war") {
> SystemProperty(name: "jetty.home", default:".")
> yield "/webapps/$projectName"
> }
> Set(name: "defaultDescriptor") {
> SystemProperty(name: "jetty.home", default: ".")
> yield '/etc/webapps/webdefault.xml'
> }
> }
> writer.toString()
> }
> --
> output is this:
> --
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> <Configure class='org.mortbay.jetty.webapp.WebAppContext'>
>   <Set name='contextPath'>/projectName</Set>/webapps/projectName
>   <Set name='war'>
>     <SystemProperty name='jetty.home' default='.' />/webapps/projectName
>   </Set>/etc/webapps/webdefault.xml
>   <Set name='defaultDescriptor'>
>     <SystemProperty name='jetty.home' default='.' />/etc/webapps/webdefault.xml
>   </Set>
> </Configure>
> --
> unneeded text is appended just after some </Set>.
> When invoking the script as a Gant target,
> the text is repeated 3 times.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

<hr/>
<p>
To unsubscribe from this list please visit:
</p>
<p>
    <a href="http://xircles.codehaus.org/manage_email">http://xircles.codehaus.org/manage_email</a>


[gant-scm] [jira] Updated: (GANT-108) Strange behaviour of MarkupBuilder in Gant

by JIRA jira@codehaus.org :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message


     [ http://jira.codehaus.org/browse/GANT-108?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Russel Winder updated GANT-108:
-------------------------------

    Summary: Strange behaviour of MarkupBuilder in Gant  (was: Handling MarkupBuilder 'yield' keyword)

Changed the title to better reflect the actual problem rather than the originally perceived one.

> Strange behaviour of MarkupBuilder in Gant
> ------------------------------------------
>
>                 Key: GANT-108
>                 URL: http://jira.codehaus.org/browse/GANT-108
>             Project: Gant
>          Issue Type: Bug
>    Affects Versions: 1.8.1
>         Environment: Groovy 1.6.5
>            Reporter: MSJ
>         Attachments: build.gant, build.gant
>
>
> On only Groovy is OK.
> if a following target or method invoked in a Gant script:
> --
> // variable 'projectName' is defined in a properties file and loaded. (i.e. "projectName=projectName")
> def getMarkup() {
> def writer = new StringWriter()
> writer.write(
> '''<?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> ''')
> def xml = new MarkupBuilder(writer)
> xml.Configure(class: "org.mortbay.jetty.webapp.WebAppContext") {
> Set(name: "contextPath", "/$projectName")
> Set(name: "war") {
> SystemProperty(name: "jetty.home", default:".")
> yield "/webapps/$projectName"
> }
> Set(name: "defaultDescriptor") {
> SystemProperty(name: "jetty.home", default: ".")
> yield '/etc/webapps/webdefault.xml'
> }
> }
> writer.toString()
> }
> --
> output is this:
> --
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> <Configure class='org.mortbay.jetty.webapp.WebAppContext'>
>   <Set name='contextPath'>/projectName</Set>/webapps/projectName
>   <Set name='war'>
>     <SystemProperty name='jetty.home' default='.' />/webapps/projectName
>   </Set>/etc/webapps/webdefault.xml
>   <Set name='defaultDescriptor'>
>     <SystemProperty name='jetty.home' default='.' />/etc/webapps/webdefault.xml
>   </Set>
> </Configure>
> --
> unneeded text is appended just after some </Set>.
> When invoking the script as a Gant target,
> the text is repeated 3 times.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

<hr/>
<p>
To unsubscribe from this list please visit:
</p>
<p>
    <a href="http://xircles.codehaus.org/manage_email">http://xircles.codehaus.org/manage_email</a>


[gant-scm] [jira] Updated: (GANT-108) Strange behaviour of MarkupBuilder in Gant

by JIRA jira@codehaus.org :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message


     [ http://jira.codehaus.org/browse/GANT-108?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Russel Winder updated GANT-108:
-------------------------------

    Environment: Groovy 1.6.5.  Also fails with Gant Trunk using Groovy Trunk 2009-10-29.  (was: Groovy 1.6.5)

Problem exists with trunk Gant/Groovy as well as released one.

> Strange behaviour of MarkupBuilder in Gant
> ------------------------------------------
>
>                 Key: GANT-108
>                 URL: http://jira.codehaus.org/browse/GANT-108
>             Project: Gant
>          Issue Type: Bug
>    Affects Versions: 1.8.1
>         Environment: Groovy 1.6.5.  Also fails with Gant Trunk using Groovy Trunk 2009-10-29.
>            Reporter: MSJ
>         Attachments: build.gant, build.gant
>
>
> On only Groovy is OK.
> if a following target or method invoked in a Gant script:
> --
> // variable 'projectName' is defined in a properties file and loaded. (i.e. "projectName=projectName")
> def getMarkup() {
> def writer = new StringWriter()
> writer.write(
> '''<?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> ''')
> def xml = new MarkupBuilder(writer)
> xml.Configure(class: "org.mortbay.jetty.webapp.WebAppContext") {
> Set(name: "contextPath", "/$projectName")
> Set(name: "war") {
> SystemProperty(name: "jetty.home", default:".")
> yield "/webapps/$projectName"
> }
> Set(name: "defaultDescriptor") {
> SystemProperty(name: "jetty.home", default: ".")
> yield '/etc/webapps/webdefault.xml'
> }
> }
> writer.toString()
> }
> --
> output is this:
> --
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> <Configure class='org.mortbay.jetty.webapp.WebAppContext'>
>   <Set name='contextPath'>/projectName</Set>/webapps/projectName
>   <Set name='war'>
>     <SystemProperty name='jetty.home' default='.' />/webapps/projectName
>   </Set>/etc/webapps/webdefault.xml
>   <Set name='defaultDescriptor'>
>     <SystemProperty name='jetty.home' default='.' />/etc/webapps/webdefault.xml
>   </Set>
> </Configure>
> --
> unneeded text is appended just after some </Set>.
> When invoking the script as a Gant target,
> the text is repeated 3 times.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

<hr/>
<p>
To unsubscribe from this list please visit:
</p>
<p>
    <a href="http://xircles.codehaus.org/manage_email">http://xircles.codehaus.org/manage_email</a>


[gant-scm] [jira] Commented: (GANT-108) Strange behaviour of MarkupBuilder in Gant

by JIRA jira@codehaus.org :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/GANT-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=196745#action_196745 ]

MSJ commented on GANT-108:
--------------------------

Thank you for changing the title to properly one.
I'd like to inspect the sources and things when I can have time.

Probably already you know well,
and I can't yet find the core things though ...

I think that there is a dynamic method related "'this' is which this ?" like problem.
I added some lines to your code like this for getting hints:
{code}
import groovy.xml.MarkupBuilder

target ( 'default' : '' ) {
  def writer = new StringWriter ( )
  def xml = new MarkupBuilder ( writer )
  xml.Configure {
    println "1: delegates to $delegate"
    Set {
        println "2: delegates to $delegate"
        println ( 'Hello' )
    }
  }
  println ( writer.toString ( ) )
}
{code}

output is like this:
{code}
...
1: delegates to groovy.xml.MarkupBuilder@xxxxx
2: delegates to org.codehaus.gant.GantBuilder@yyyyy
Hello
2: delegates to org.codehaus.gant.GantBuilder@yyyyy
Hello
2: delegates to groovy.xml.MarkupBuilder@xxxx
Hello
<Configure>
  <Set />
</Configure>
...
{code}

This gives some hints ?
(or more confusion ? I'm thinking in progress.)

> Strange behaviour of MarkupBuilder in Gant
> ------------------------------------------
>
>                 Key: GANT-108
>                 URL: http://jira.codehaus.org/browse/GANT-108
>             Project: Gant
>          Issue Type: Bug
>    Affects Versions: 1.8.1
>         Environment: Groovy 1.6.5.  Also fails with Gant Trunk using Groovy Trunk 2009-10-29.
>            Reporter: MSJ
>         Attachments: build.gant, build.gant
>
>
> On only Groovy is OK.
> if a following target or method invoked in a Gant script:
> --
> // variable 'projectName' is defined in a properties file and loaded. (i.e. "projectName=projectName")
> def getMarkup() {
> def writer = new StringWriter()
> writer.write(
> '''<?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> ''')
> def xml = new MarkupBuilder(writer)
> xml.Configure(class: "org.mortbay.jetty.webapp.WebAppContext") {
> Set(name: "contextPath", "/$projectName")
> Set(name: "war") {
> SystemProperty(name: "jetty.home", default:".")
> yield "/webapps/$projectName"
> }
> Set(name: "defaultDescriptor") {
> SystemProperty(name: "jetty.home", default: ".")
> yield '/etc/webapps/webdefault.xml'
> }
> }
> writer.toString()
> }
> --
> output is this:
> --
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
> <Configure class='org.mortbay.jetty.webapp.WebAppContext'>
>   <Set name='contextPath'>/projectName</Set>/webapps/projectName
>   <Set name='war'>
>     <SystemProperty name='jetty.home' default='.' />/webapps/projectName
>   </Set>/etc/webapps/webdefault.xml
>   <Set name='defaultDescriptor'>
>     <SystemProperty name='jetty.home' default='.' />/etc/webapps/webdefault.xml
>   </Set>
> </Configure>
> --
> unneeded text is appended just after some </Set>.
> When invoking the script as a Gant target,
> the text is repeated 3 times.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

<hr/>
<p>
To unsubscribe from this list please visit:
</p>
<p>
    <a href="http://xircles.codehaus.org/manage_email">http://xircles.codehaus.org/manage_email</a>

< Prev | 1 - 2 | Next >