Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Converting NT:Folder to Sling:Folder

Avatar

Level 4

We are working on multiple projects, which all root from the same sub-node and somehow the two different projects have diverged on a root node to the project.

  • Project 1 path: /content/subnode/project1
  • Project 2 path: /content/subnode/project2

My problem is with subnode

Project 1 Installed first: subnode type is nt:folder (it actually doesn't have .content.xml in the source code)

Project 2 installed second: subnode type is sling:orderedFolder Building locally works fine. Building through our build system to test environment fails to install the package and throws nodeType Constraint exception do to subnode.

Now that the node is in the system as nt:folder I have a mental check to make sure all our projects under this node (6-7 projects). If any projects in a new environment get installed in a different order and happen to have a different node structure it breaks the build.

Is there a safer node type that won't throw this exception and can just be overwritten for each project? Should I just make sure they are all nt:folder or sling:orderedFolder? My main objective here is to not have that node breaking an install.

Thanks

3 Replies

Avatar

Level 10

IN CRXDE lite - when organizing your AEM projects - use nt:folder. That is, right click and select Folder - not node then node type.

Here is a good blog that states he difference: 

https://cqwemblog.wordpress.com/2013/12/15/difference-between-ntfolder-slingfolder-slingorderedfolde...

I have never seen issues using nt:folder. 

Hope this helps. 

Avatar

Level 10

Hi Tyler,

nt:folder represents a plain file system folder (it can have nt:folder and nt:file children and only a few restricted meta data properties).

sling:folder is basically nt:folder + nt:unstructured in one, i.e. it can be used inside other nt:folders, but it comes with residual (arbitrary, wildcard) properties and child nodes.

Also

* you are free to add whatever property you want in a sling:folder (not in a nt:folder)

* you are free to add whatever nodetype you want in a sling:folder (not in a nt:folder)

Hope this helps!!

Thanks,
Ratna Kumar.