You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by ba...@gmail.com on 2021/04/14 19:03:38 UTC
default value for configurable bootclasspath in javac
Hi. I've got the following in my build xml:
<property name="javac.bootclasspath" value="" />
<presetdef name="myjavac">
<javac source="1.7" target="1.7" includeantruntime="no" bootclasspath="${javac.bootclasspath}" >
</javac>
</presetdef>
The idea is to not alter bootclasspath when the caller did not provide an explicit -Djavac.bootclasspath=...
An empty string as the default value works fine with Sun Javac, but it fails with: <javac compiler="org.eclipse.jdt.core.JDTCompilerAdapter">
[myjavac] The type java.lang.Double cannot be resolved. It is indirectly referenced from required .class files
[myjavac] ----------
[myjavac] 1 problem (1 error)
Since the presetdef task does not support conditional attributes I'm asking for an advice on how to make it work.
This is Ant 1.10.8 bundled with Eclipse.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: default value for configurable bootclasspath in javac
Posted by ba...@gmail.com.
I managed to solve the problem with a script:
<property name="javac.bootclasspath" value=""/>
<presetdef name="myjavac">
<javac source="1.7" target="1.7" includeantruntime="no">
</javac>
</presetdef>
<script id="myjavac_optional_attrs" language="javascript">
var bootclasspath = project.getProperty("javac.bootclasspath");
/* bootclasspath="" fails with Eclipse Compiler */
if (bootclasspath) {
var myjavacPreSetsWrapper = org.apache.tools.ant.ComponentHelper.getComponentHelper(project).getAntTypeTable().get("myjavac").getPreSets().getWrapper();
myjavacPreSetsWrapper.setAttribute("bootclasspath", bootclasspath);
}
</script>
On 14.04.2021 22:03, basinilya@gmail.com wrote:
> Hi. I've got the following in my build xml:
>
> <property name="javac.bootclasspath" value="" />
>
> <presetdef name="myjavac">
> <javac source="1.7" target="1.7" includeantruntime="no" bootclasspath="${javac.bootclasspath}" >
> </javac>
> </presetdef>
>
> The idea is to not alter bootclasspath when the caller did not provide an explicit -Djavac.bootclasspath=...
> An empty string as the default value works fine with Sun Javac, but it fails with: <javac compiler="org.eclipse.jdt.core.JDTCompilerAdapter">
>
> [myjavac] The type java.lang.Double cannot be resolved. It is indirectly referenced from required .class files
> [myjavac] ----------
> [myjavac] 1 problem (1 error)
>
> Since the presetdef task does not support conditional attributes I'm asking for an advice on how to make it work.
>
> This is Ant 1.10.8 bundled with Eclipse.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org