[ 
https://issues.apache.org/jira/browse/SLING-10035?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17266330#comment-17266330
 ] 

Eric Norman edited comment on SLING-10035 at 1/18/21, 9:40 PM:
---------------------------------------------------------------

FYI: After switching to the newly release version of the plugin, I just noticed 
that this change appears to be creating a set of empty folders in the wrong 
place in my linux environment.

Using a debugger, I see that the targetDir File object is constructed at 
AbstractFeatureMojo line 244 with the "child" second argument already resolved 
to be an absolute path.  This appears to append the absolute child path to the 
parent path rather than checking if "child" is relative or absolute to resolve 
it.

[https://github.com/apache/sling-slingfeature-maven-plugin/blob/master/src/main/java/org/apache/sling/feature/maven/mojos/AbstractFeatureMojo.java#L244]

 

Any objections to changing that line to something like below to properly 
resolve the 2 paths?

 
{code:java}
final File targetDir = 
this.project.getBasedir().toPath().resolve(this.project.getBuild().getDirectory()).toFile();
 
{code}
 

UPDATE: I've created SLING-10069  for tracking the problem.


was (Author: enorman):
FYI: After switching to the newly release version of the plugin, I just noticed 
that this change appears to be creating a set of empty folders in the wrong 
place in my linux environment.

Using a debugger, I see that the targetDir File object is constructed at 
AbstractFeatureMojo line 244 with the "child" second argument already resolved 
to be an absolute path.  This appears to append the absolute child path to the 
parent path rather than checking if "child" is relative or absolute to resolve 
it.

[https://github.com/apache/sling-slingfeature-maven-plugin/blob/master/src/main/java/org/apache/sling/feature/maven/mojos/AbstractFeatureMojo.java#L244]

 

Any objections to changing that line to something like below to properly 
resolve the 2 paths?

 
{code:java}
final File targetDir = 
this.project.getBasedir().toPath().resolve(this.project.getBuild().getDirectory()).toFile();
 
{code}
 

> Sling Feature fails when Generated Features Directory is missing
> ----------------------------------------------------------------
>
>                 Key: SLING-10035
>                 URL: https://issues.apache.org/jira/browse/SLING-10035
>             Project: Sling
>          Issue Type: Bug
>          Components: Feature Model
>    Affects Versions: slingfeature-maven-plugin 1.4.20
>            Reporter: Andreas Schaefer
>            Assignee: Andreas Schaefer
>            Priority: Major
>             Fix For: slingfeature-maven-plugin 1.4.22
>
>
> When I want to aggregate a Feature Model in another module like 'all' and 
> there is not attachment or other FM generation task beforehand the Sling 
> Feature Maven Plugin fails in handleGeneratedFeatures() method. This can be 
> fixed by copying the target folder from the resources but that is a lot of 
> unnecessary work.
>  
> I added code to that method that tries to create the folder if it does not 
> exist.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to