You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2011/11/22 13:41:13 UTC
DO NOT REPLY [Bug 52227] New: manifestclasspath makes paths relative
to build dir and not jarfile
https://issues.apache.org/bugzilla/show_bug.cgi?id=52227
Bug #: 52227
Summary: manifestclasspath makes paths relative to build dir
and not jarfile
Product: Ant
Version: 1.8.2
Platform: PC
Status: NEW
Severity: normal
Priority: P2
Component: Core tasks
AssignedTo: notifications@ant.apache.org
ReportedBy: tgkprog@gmail.com
Classification: Unclassified
Created attachment 27974
--> https://issues.apache.org/bugzilla/attachment.cgi?id=27974
test build file, sample jar and class
not sure if this is a windows issue.
if my build folder is d:/prog/j/anttestManifestClasspath
but the final run folder is d:/run/anttestManifestClasspath
i run ant from the build folder with a manifestclasspath task and jar task with
manifest that uses the classpath created here, the relative folders are not to
final jar file in d:/run/anttest but to my build folder.
I think its a bug as the full path to the final jar is given to
manifestclasspath task so the paths should be relative to that.
Would suggest the documentation reflect this if its as expected.
Workaround exists - call another build file from the main file and keep that
build file's base dir as the run folder
Important when the build file is old and has relative paths to it so we cant
change from where the build is started nor can we change the base dir
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 52227] manifestclasspath makes paths relative to
build dir and not jarfile
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52227
--- Comment #4 from Stefan Bodewig <bo...@apache.org> 2011-12-03 07:00:10 UTC ---
You are misreading the manual then.
If you say <pathelement path="lib/log4j.jar" /> then this will be a path
relative to your project's basedir - it points to the jar inside your
build directory.
<manifestclasspath> calculates the path of this file relative to the
jar you specify in the task's jarfile attribute. Of course it is the
log4j.jar file in your build directory, you told it to use that.
<manifestclasspath> only works if the things you put into the classpath
already are reachable using the same relative paths to the specified jarfile
as they will be when deployed. In your case this is not true.
It would work if you set the jarfile attribute to a-classpath3.jar without any
leading path so it is assumed to the top level of your build directory
and lib/log4j.jar is the relative path from there.
The reason it works when you invoke things via <ant> from a build file
in your destination directory is the way basedir is reset when using <ant>.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 52227] manifestclasspath makes paths relative to
build dir and not jarfile
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52227
Tushar Kapila <tg...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
--- Comment #5 from Tushar Kapila <tg...@gmail.com> 2011-12-03 21:19:31 UTC ---
had a look at the old script that I made for work ...
i had given the full path to the jars that were to go in to the manifest class
path but not to the class-path-jar when i tried this with a real example.
in this sample the mistake was the non full path to the lib jar
so only thing that would be good to add to docs :
enter full path when we defining jarfile in manifestclasspath as paths in
manifest are relative to that.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 52227] manifestclasspath makes paths relative to
build dir and not jarfile
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52227
Tushar Kapila <tg...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEEDINFO |NEW
--- Comment #3 from Tushar Kapila <tg...@gmail.com> 2011-12-02 21:01:49 UTC ---
lasspath-make:
[echo] Start classpath:
[echo]
../../Users/stefan.bodewig/Desktop/ant-test-manifest-cp/lib/log4j.jar
[echo] end
[echo] file :/run/anttestManifestClasspath/a-classpath3.jar
[jar] Building MANIFEST-only jar:
C:\run\anttestManifestClasspath\a-classpath3.jar
[echo] Jar done
BUILD SUCCESSFUL
the path in the manifest is printed after [echo] Start classpath:
../../Users/stefan.bodewig/Desktop/ant-test-manifest-cp/lib/log4j.jar
[echo] end
This is your build path.
expected is lib/log4j.jar
at run time there will be no dir
sers/stefan.bodewig/Desktop/ant-test-manifest-cp/lib/
The app & this classpath jar will be at
d:/run/anttestManifestClasspath/a-classpath3.jar
the lib dir will be
d:/run/anttestManifestClasspath/lib
so a relative path from d:/run/anttestManifestClasspath/a-classpath3.jar to
d:/run/anttestManifestClasspath/lib/log4j.jar will be:-
[echo] Start classpath:
[echo]
lib/log4j.jar
[echo] end
if you run the build process from d:\run\anttestManifestClasspath\
or simple change the
basedir=""
to
basedir="d:/run/anttestManifestClasspath/"
you will get expected output
Note on windows when giving a path to java can give
d:/run/anttestManifestClasspath/ or d:\run\anttestManifestClasspath\
only need to use \ before invoking jvm so have used both slashes ....
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 52227] manifestclasspath makes paths relative to
build dir and not jarfile
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52227
Stefan Bodewig <bo...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |NEEDINFO
--- Comment #2 from Stefan Bodewig <bo...@apache.org> 2011-12-02 16:06:33 UTC ---
OK, I unzipped your attachment on my Desktop (Windows7) and ran "ant" inside
the unzpped dir (after creating the directory c:\run\anttestManifestClasspath
directory).
This is what I get:
Buildfile: C:\Users\stefan.bodewig\Desktop\ant-test-manifest-cp\build.xml
classpath-make:
[echo] Start classpath:
[echo]
../../Users/stefan.bodewig/Desktop/ant-test-manifest-cp/lib/log4j.jar
[echo] end
[echo] file :/run/anttestManifestClasspath/a-classpath3.jar
[jar] Building MANIFEST-only jar:
C:\run\anttestManifestClasspath\a-classpath3.jar
[echo] Jar done
BUILD SUCCESSFUL
Total time: 0 seconds
This looks as expected to me. The path is relative to the jar and certainly
not relative to my build directory.
This is as it should be, isn't it?
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 52227] manifestclasspath makes paths relative to
build dir and not jarfile
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52227
Tushar Kapila <tg...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
OS/Version| |All
--- Comment #1 from Tushar Kapila <tg...@gmail.com> 2011-11-22 12:45:12 UTC ---
see
http://mail-archives.apache.org/mod_mbox/ant-dev/201111.mbox/%3C87ty6ntwab.fsf%40v35516.1blu.de%3E
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.