Summary: | javac: properties for default source and target version | ||
---|---|---|---|
Product: | Ant | Reporter: | Martin von Gagern <Martin.vGagern> |
Component: | Core tasks | Assignee: | Ant Notifications List <notifications> |
Status: | RESOLVED WORKSFORME | ||
Severity: | enhancement | CC: | jglick |
Priority: | P2 | ||
Version: | 1.6.2 | ||
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | All | ||
URL: | https://bugs.gentoo.org/show_bug.cgi?id=86903 |
Description
Martin von Gagern
2005-06-11 00:52:59 UTC
Please see <presetdef> documentation at http://ant.apache.org/manual/CoreTasks/presetdef.html. I was thinking about a project with a build.xml that was written by someone else, doesn't provide any version information at all, and I don't want to modify the build file itself and still be able to compile the project with reasonable defaults for my system. In this case you'd either have to rewrite the build.xml to introduce those attrributes or to introduce using the presetdef defined task instead of the plain javac. I don't see much difference between those two approaches. Or is there a way to override core tasks by modified versions in an antlib by just using command line arguments? You can create a separate build file with <presetdef> and <import> of the old build file. ... or write a build files that copies the original build file, inserts <presetdef/> just after <project.*?>, and executes <ant/> with new file. IMHO people using <javac> should always specify source (which implies a reasonable target as well). If you wrote the sources, you know what source level they use, so you should declare it. There is no reason I can see to make this variable dependent on system config. (Obviously if some project is using a source level higher than that supported by the compiler Ant is running, you are in trouble, but using a magic value for the source level would just give you compiler errors anyway.) BTW the <javac> doc page already recommends that source always be explicit. |