This is an automated email from the ASF dual-hosted git repository.
cziegeler pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/sling-slingfeature-maven-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new 51d32f4 SLING-9518 : ApisJarMojo: Sling-Nodetypes header not
containing prefix
51d32f4 is described below
commit 51d32f466ca001cddea9de28302c29f8bc0b67e6
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Mon Jun 15 07:55:59 2020 +0200
SLING-9518 : ApisJarMojo: Sling-Nodetypes header not containing prefix
---
.../org/apache/sling/feature/maven/mojos/ApisJarMojo.java | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git
a/src/main/java/org/apache/sling/feature/maven/mojos/ApisJarMojo.java
b/src/main/java/org/apache/sling/feature/maven/mojos/ApisJarMojo.java
index 8bd7aad..5cf326e 100644
--- a/src/main/java/org/apache/sling/feature/maven/mojos/ApisJarMojo.java
+++ b/src/main/java/org/apache/sling/feature/maven/mojos/ApisJarMojo.java
@@ -1214,6 +1214,8 @@ public class ApisJarMojo extends
AbstractIncludingFeatureMojo {
for (final String resourceName : directoryScanner.getIncludedFiles()) {
final File resource = new File(info.getBinDirectory(),
resourceName);
+
+ String includedName = resourceName.replace(File.separatorChar,
'/');
if ( !info.getIncludedResources().contains(resource) ) {
final String prefix = artifactId.toMvnName().concat("-");
@@ -1232,10 +1234,16 @@ public class ApisJarMojo extends
AbstractIncludingFeatureMojo {
throw new MojoExecutionException("Impossible to rename
resource " + resource + " to " + renamed
+ ", please check the current user has enough
rights on the File System");
}
+ final int lastSlash = includedName.lastIndexOf('/');
+ if ( lastSlash == -1 ) {
+ includedName = renamed.getName();
+ } else {
+ includedName = includedName.substring(0, lastSlash +
1).concat(renamed.getName());
+ }
}
}
- if (
resourceName.endsWith(ArtifactType.CND.getContentExtension())) {
- info.getNodeTypes().add(resourceName);
+ if (
includedName.endsWith(ArtifactType.CND.getContentExtension())) {
+ info.getNodeTypes().add(includedName);
}
}