[
https://issues.apache.org/jira/browse/SLING-8800?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16959917#comment-16959917
]
Andreas Schaefer commented on SLING-8800:
-----------------------------------------
The attached ZIP file contains a test project (generated with the Sling Project
Archetype).
To see the issue to the following:
* Go to folder ui.apps/src/main/content/jcr_root/apps/test2/page
* Create a file test.html and add some content
* Build it (mvn clean install)
* Look into the the temporary folder (search the logs for 'Building zip:'
which should point out the folder)
* List the deflated folder: 'ls -lta
ui.apps-1.0.0-SNAPSHOT.zip-deflated/jcr_root/apps/test2/page`
* The 'test.html' file should be there next to page.html etc
* Now delete this file in your source folder
* Rebuild with (mvn clean install)
* List the deflated folder once more and the file is still there
This is how I fixed it in my project inside the VaulPackageAssembler:
{code:java}
private static VaultPackageAssembler create(VaultPackage vaultPackage,
WorkspaceFilter filter) {
File storingDirectory = new File(TMP_DIR, vaultPackage.getFile().getName()
+ "-deflated");
if(storingDirectory.exists()) {
File backup = new File(storingDirectory.getPath() + ".backup");
if(backup.exists()) {
try {
FileUtils.deleteDirectory(backup);
} catch(IOException e) {
throw new RuntimeException("Unable to delete backup folder: '"
+ backup + "'", e);
}
}
if(!storingDirectory.renameTo(backup)) {
throw new RuntimeException("Unable to rename folder: '" +
storingDirectory + "' to folder: '" + backup + "'");
}
}
// avoid any possible Stream is not a content package. Missing 'jcr_root'
error
File jcrRootDirectory = new File(storingDirectory, ROOT_DIR);
...{code}
I just kept the old folder there for comparison purposes.
> A change in a Content Package will not be reflected in a Converted CP on a
> rebuild
> ----------------------------------------------------------------------------------
>
> Key: SLING-8800
> URL: https://issues.apache.org/jira/browse/SLING-8800
> Project: Sling
> Issue Type: Bug
> Components: Feature Model
> Reporter: Andreas Schaefer
> Assignee: Andreas Schaefer
> Priority: Major
> Fix For: Content-Package to Feature Model Converter 1.0.0
>
> Attachments: secondary-test.zip
>
>
> After a successful content package conversion any change in a content package
> will not be reflected in a converted content package.
> The reason is that the temporary generated file inside a temporary folder
> created in the VaultPackageAssembler is not deleted.
> The CP Converter should at least provide a flag to force the deletion but
> maybe it is best to use a hash to see if the content has changed and if
> should delete the temporary folder.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)