This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag maven-sling-plugin-2.0.4-incubator
in repository https://gitbox.apache.org/repos/asf/sling-maven-sling-plugin.git

commit 517bab9e0590c0389dc57773e1092936edca4ac7
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Sat Mar 28 14:25:18 2009 +0000

    SLING-876 : Handle optional target path on resource configuration when 
searching a resource.
    
    git-svn-id: 
https://svn.apache.org/repos/asf/incubator/sling/trunk/maven/maven-sling-plugin@759467
 13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/maven/bundlesupport/AbstractBundleInstallMojo.java  | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git 
a/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java
 
b/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java
index 1f5a883..7604b30 100644
--- 
a/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java
+++ 
b/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java
@@ -369,7 +369,16 @@ abstract class AbstractBundleInstallMojo extends 
AbstractBundlePostMojo {
             final Iterator i = resources.iterator();
             while ( dir == null && i.hasNext() ) {
                 final Resource rsrc = (Resource)i.next();
-                dir = new File(rsrc.getDirectory(), path);
+                String child = path;
+                // if resource mapping defines a target path: remove target 
path from checked resource path
+                String targetPath = rsrc.getTargetPath();
+                if ( targetPath != null && !targetPath.endsWith("/") ) {
+                    targetPath = targetPath + "/";
+                }
+                if ( targetPath != null && path.startsWith(targetPath) ) {
+                    child = child.substring(targetPath.length());
+                }
+                dir = new File(rsrc.getDirectory(), child);
                 if ( !dir.exists() ) {
                     dir = null;
                 }

-- 
To stop receiving notification emails like this one, please contact
"[email protected]" <[email protected]>.

Reply via email to