I am not sure if I understand completely. It sounds like, rather than setting
$this->version
you should instead call
$this->project->setProperty('version', $version);
This will add the 'version' property to your project instance. You won't need to have to set the attribute for your task, unless say, you will want to later change what property name in your project gets set (from 'version' to some other property).
`
<adhoc-task name="appversion" ><![CDATA[
class AppversionTask extends Task {
function main() {
$manifest = file_get_contents("manifest.json");
$manifest_json = json_decode($manifest);
$version = $manifest_json->version;
$this->log("App version: " . $version);
$this->project->setProperty('version', $version);
}
}
]]></adhoc-task>
<appversion />
<!-- The version property should now be set -->
<echo message="${version}" />
`