()
| 566 | } |
| 567 | |
| 568 | @Override |
| 569 | public String getName() { |
| 570 | if(name != null) return name; |
| 571 | |
| 572 | // url.getPath() works for jar URLs; url.toURI().getPath() doesn't |
| 573 | // because jars aren't considered "hierarchical" |
| 574 | name = getBaseURL().getPath(); |
| 575 | if(name.endsWith("/")) { |
| 576 | name = name.substring(0, name.length() - 1); |
| 577 | } |
| 578 | int lastSlash = name.lastIndexOf("/"); |
| 579 | if(lastSlash != -1) { |
| 580 | name = name.substring(lastSlash + 1); |
| 581 | } |
| 582 | try { |
| 583 | // convert to (relative) URI and extract path. This will |
| 584 | // decode any %20 escapes in the name. |
| 585 | name = new URI(name).getPath(); |
| 586 | } catch(URISyntaxException ex) { |
| 587 | // ignore, this should have been checked when adding the URL! |
| 588 | } |
| 589 | return name; |
| 590 | } |
| 591 | } |
| 592 | |
| 593 | public static class Maven extends Plugin |
no test coverage detected