Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-3450

Ant properties don't work within the source / target attributes on javac Ant task within groovyc task

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.6
    • 1.6.4, 1.7-beta-1
    • Ant integration
    • None
    • Groovy 1.6.0, Ant 1.7.1, Java 1.5.0_16, Windows XP.

    Description

      With Groovy 1.5.1, I used the <groovyc> Ant task with a nested <javac> which has the 'source' and 'target' attributes specified using Ant properties:

      <groovyc ...
      <javac debug="${javac.debug}" source="${javac.compatibility.source.version}" target="${javac.compatibility.target.version}"/>
      </groovyc>

      The 'javac.compatibility.source.version' and 'javac.compatibility.target.version' properties are both set to '1.4'. This worked fine in 1.5.1, but upgrading to Groovy 1.6.0 I get the following error:

      [groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Invalid commandline usage for javac.
      [groovyc] javac: invalid source release: ${javac.compatibility.source.version}

      The properties are set up correctly (<echoproperties/> proves it), but for some reason they're not getting resolved in this particular context. If I convert the Ant script to use AntBuilder within a <groovy> script element, it resolves the problem, e.g.

      <groovy>
      ant.groovyc( ... ) {
      ...
      javac( debug:properties["javac.debug"], source:properties["javac.compatibility.source.version"], target:properties["javac.compatibility.target.version"] )
      }
      </groovy>

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              alrodgers Alastair Rodgers
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: