ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominique Devienne" <ddevie...@gmail.com>
Subject Re: Strange behaviour of <manifestclasspath>
Date Wed, 15 Oct 2008 18:47:28 GMT
On Tue, Oct 14, 2008 at 3:46 PM, andbin <abin73@cheapnet.it> wrote:
> <project name="Manifest classpath test">
>  <path id="initial.path">
>    <pathelement location="${basedir}/file1.jar"/>
>    <pathelement location="${basedir}/lib/file2.jar"/>
>    <pathelement location="${basedir}"/>
>  </path>

FYI: use either file="${basedir}/..." or location="...", but using
both, while OK, doesn't make much sense to me. The purpose of all
location attributes is to resolve a relative path from ${basedir}, so
to me it's redundant to say location="${basedir}/..". No big deal
though.

> C:\Test\MyProject\file1.jar;C:\Test\MyProject\lib\file2.jar;C:\Test\MyProject
>     [echo] manifest.classpath = file1.jar lib/file2.jar ../MyProject/
>
> The three relative paths generated by <manifestclasspath> are all
> technically correct. But the last is very little useful!!

More than "not-useful", it's wrong. The point of having relative paths
in the manifest is such that you can "transport" all the jars to
another dir and it continues working. Using ../Project/ works only in
a .../Project directory, so it's a bug.

I find it strange to put such a dir in the classpath, but that's
another story ;)

> According to me, the relative path should be generated as . or ./ since it's
> the most logical.

The spec says dirs must end in /, so only ./ is valid. I've never
tried such a combo though.

> BUILD FAILED
> java.lang.NullPointerException
>        at java.lang.String.startsWith(String.java:1422)
>        at java.lang.String.startsWith(String.java:1451)
>        at
> org.apache.tools.ant.taskdefs.ManifestClassPath.execute(ManifestClassPath.java:100)

As Stephan mentions, this is also clearly a bug. Escaped attention has
nobody typically puts jars or classes in the root directory ;-)

Although your paths are "usual", they have uncovered real bugs, albeit
minor ones few people will notice given a more traditional project
layout. --DD

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message