Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-ant-dev] Problems using custom ant task

Hi all,
i'm having problems using a custom ant task within eclipse.

I wrote a custom task as an extension of import, i.e. it can import ant build files from a remote location via http url. It first downloads the remote file in a specified directory using the org.apache.tools.ant.taskdefs.Get class then imports the local file via the org.apache.tools.ant.taskdefs.ImportTask.

The task works without problems both when i launch ant standalone and when i launch ant from eclipse using a separate jre, but i have a couple of problems trying to use it from within eclipse:

1- the first is that if i try to launch the ant file that uses the custom task using the same jre as eclipse it looks the Task is not completely initialized when it is executed, because for instance the same org.apache.tools.ant.ProjectComponent.getProject() method that returns a valid Project reference when the build file is launched with a separate jre, always return null when the build file is launched with the same jre as eclipse and the org.apache.tools.ant.Task.getTaskName() and org.apache.tools.ant.Task.getOwningTarget() returns null too.

2- the other problem is that when i set Get.setUseTimestamp(true), when i edit the build file the imported file is downloaded, but the import task is maked with a warning "Security exception" and i cannot see the imported tasks in Ant view. If i set  Get.setUseTimestamp(false) then the file is downloaded and imported and i can see the imported tasks in Ant view. I examined many times the Get code but i couldn't imagine what could be causing eclipse to throw a security exception when Get.setUseTimestamp(true).

The task is installed as a plugin with the following plugin.xml:
<plugin>

    <extension point="org.eclipse.ant.core.extraClasspathEntries">
        <extraClasspathEntry library="ACL-auto-ant.jar" eclipseRuntime="false"/>
    </extension>

</plugin>
and called using
xmlns:auto="antlib:it.autostrade.commonlib.ant"

Is there anybody that could explain this different ant beahviour when run within eclipse and the causes for security exceptions?

Thanks in advance, 
Gabriele
-- 

Gabriele Garuglieri
Infoblu S.p.A
Sistemi di Viabilità
Nuovo Centro Direzionale
Autostrade // per l'Italia
Svincolo Autostradale Firenze Nord
50013 Campi Bisenzio - Firenze
========================================
email:  gabriele.garuglieri@xxxxxxxxxx
email:  ggaruglieri@xxxxxxxxxxxxx
phone:  +39.055.420.2832
mobile: +39.335.1053305
========================================

Back to the top