1 | protected void addClasspathEntry(String resource) {↵ | | 1 | private void addClasspathEntry(String resource) {↵
|
2 | /*↵ | | 2 | /*↵
|
3 | * pre Ant 1.6 this method used to call getClass().getResource↵ | | 3 | * pre Ant 1.6 this method used to call getClass().getResource↵
|
4 | * while Ant 1.6 will call ClassLoader.getResource().↵ | | 4 | * while Ant 1.6 will call ClassLoader.getResource().↵
|
5 | *↵ | | 5 | *↵
|
6 | * The difference is that Class.getResource expects a leading↵ | | 6 | * The difference is that Class.getResource expects a leading↵
|
7 | * slash for "absolute" resources and will strip it before↵ | | 7 | * slash for "absolute" resources and will strip it before↵
|
8 | * delegating to ClassLoader.getResource - so we now have to↵ | | 8 | * delegating to ClassLoader.getResource - so we now have to↵
|
9 | * emulate Class's behavior.↵ | | 9 | * emulate Class's behavior.↵
|
10 | */↵ | | 10 | */↵
|
11 | if (resource.startsWith("/")) {↵ | | 11 | if (resource.startsWith("/")) {↵
|
12 | resource = resource.substring(1);↵ | | 12 | resource = resource.substring(1);↵
|
13 | } else {↵ | | 13 | } else {↵
|
14 | resource = "org/apache/tools/ant/taskdefs/optional/"↵ | | 14 | resource = "org/apache/tools/ant/taskdefs/optional/jdepend/"↵
|
15 | + resource;↵ | | 15 | + resource;↵
|
16 | }↵ | | 16 | }↵
|
|
17 | File f = LoaderUtils.getResourceSource(getClass().getClassLoader(),↵ | | 17 | File f = LoaderUtils.getResourceSource(getClass().getClassLoader(),↵
|
18 | resource);↵ | | 18 | resource);↵
|
19 | if (f != null) {↵ | | 19 | if (f != null) {↵
|
20 | log("Found " + f.getAbsolutePath(), Project.MSG_DEBUG);↵ | | 20 | log("Found " + f.getAbsolutePath(), Project.MSG_DEBUG);↵
|
21 | createClasspath().setLocation(f);↵ | | 21 | runtimeClasses.createPath().setLocation(f);↵
|
22 | } else {↵ | | 22 | } else {↵
|
23 | log("Couldn\'t find " + resource, Project.MSG_VERBOSE);↵ | | 23 | log("Couldn\'t find " + resource, Project.MSG_DEBUG);↵
|
24 | | | 24 |
|