ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 50953] New: Tasks defined with an antlib within a jar in succeeds with Ant 1.7.1 and fails with 1.8.2
Date Mon, 21 Mar 2011 12:53:58 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=50953

           Summary: Tasks defined with an antlib within a jar in succeeds
                    with Ant 1.7.1 and fails with 1.8.2
           Product: Ant
           Version: 1.8.2
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
        AssignedTo: notifications@ant.apache.org
        ReportedBy: antuser@mindspring.com


Here is the project build.xml:

<?xml version="1.0" encoding="utf-8"?>
<project name="build" default="all" xmlns:test="antlib:com.test.tools.ant"> 
    <typedef resource="com/test/tools/ant/extensions.xml" />
    <typedef uri="antlib:com.test.tools.ant"
resource="com/test/tools/ant/extensions.xml"/>
    <test:importProjectDefinition/>
    <echo message="${test}"/>
</project>

Here is a properties file to be imported that resides in the same directory as
the build.xml.  It contains:

<project name="properties">
    <property name="test" value="test_value"/>
</project>

test.jar contains an antlib in extensions.xml:

<?xml version="1.0"?>
<antlib xmlns:current="ant:current" xmlns:test="antlib:com.test.tools.ant">
    <macrodef name="importProjectDefinition">
        <sequential>
            <import file="${basedir}\properties.xml" />
        </sequential>
    </macrodef>
</antlib>

When you build on Windows the project fails with the following traceback when
attempting the import.  The import only fails when the antlib is inside of a
jar.  In the debugger it appears that the file in the jar does not exist and
the code then tests for a URL
(C:\EclipseDevelopment\test_4_head\test_case\script/properties.xml) which of
course would be malformed as a URL.  The same build fails on linux with a
similar traceback.  Here is the relevant section of the Windows log:

[import] java.net.MalformedURLException: unknown protocol: c

BUILD FAILED
C:\EclipseDevelopment\test_4_head\test_case\script\build.xml:5: The following
error occurred while executing this line:
jar:file:/C:/EclipseDevelopment/test_4_head/eclipse.proxy.project/output/build/test/4.0/staging/ant/lib/test.jar!/com/
test/tools/ant/extensions.xml:5: failed to resolve
C:\EclipseDevelopment\test_4_head\test_case\script\properties.xml relative to
jar:file:/C:/EclipseDevelopment/test_4_head/eclipse.proxy.project/output/build/test/4.0/staging/ant/lib/test.jar!/com/test/tools/ant/extensions.xml
    at
org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:551)
    at
org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:401)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:390)
    at
org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:180)
    at
org.eclipse.ant.internal.launching.remote.InternalAntRunner.parseBuildFile(InternalAntRunner.java:191)
    at
org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:400)
    at
org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:137)
Caused by:
jar:file:/C:/EclipseDevelopment/test_4_head/eclipse.proxy.project/output/build/test/4.0/staging/ant/lib/test.jar!/com/test/tools/ant/extensions.xml:5:
failed to resolve
C:\EclipseDevelopment\test_4_head\test_case\script\properties.xml relative to
jar:file:/C:/EclipseDevelopment/test_4_head/eclipse.proxy.project/output/build/test/4.0/staging/ant/lib/test.jar!/com/test/tools/ant/extensions.xml
    at
org.apache.tools.ant.taskdefs.ImportTask.getFileAttributeResource(ImportTask.java:262)
    at org.apache.tools.ant.taskdefs.ImportTask.execute(ImportTask.java:158)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at
org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:398)
    ... 12 more

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Mime
View raw message