Difference between creating a folder and creating a project in CRXDE Lite in CQ5 - aem

I am using CQ5 and trying to create my first component and template. While creating a component/template in apps folder we always create a folder and not a project.
I want to know what is a difference between a folder and a project.

The only difference is creating a folder just creates a folder, whereas creating a project creates a sample working project.
When you use Create Folder ... option in CRXDE, it tries to create a folder under the selected path in the repository. You need to use this option multiple times to create the required project structure, as well as create the appropriate components, templates, bundles, content and packages accordingly.
Whereas, you use the Create Project ... option in CRXDE, regardless of the current path you are in, it creates the following
/apps/<<project-name>> - The project container
/apps/<<project-name>>/components - The components folder for your project, containing a sample component.
/apps/<<project-name>>/src - The src folder, containing a sample bundle source code.
/apps/<<project-name>>/install - The install folder, containing the built bundle
/content/<<project-name>> - The content node, which sling:resourceType pointing to the sample component in your project.
/etc/packages/<<java-suffix>>/<<project-name>>.zip - The package for your project, with the filters /apps/<<project-name>> and /content/<<project-name>>
Like mentioned before, it would be a working sample. Hence accessing http://<<server-host>>:<<port>>/content/<<project-name>>.html, would actually display the text
Hello World
The Adobe documentation for Developing with CRXDE Lite itself is self explanatory.

Related

Extra solution folder getting created in multi-project templates

I have created a multi Project template and published it in VS via VSIX. My problem is when I create a new project via the template an extra solution folder is getting created which contains all the projects and solution file is getting created one level up the hierarchy.
Actual result: -> SoltnName folder
--> SoltnName Folder
------>Project1Folder
------>Project2Folder
--> Solutn File
Expected Result: -> SoltnName folder
---->Project1Folder
---->Project2Folder
----> Solutn File
I tried by setting property CreateNewFolder to False in solution level template file & it's not working. I checked other posts as well and didn't find any good workaround on this. Is there any way I can handle the situation?

How to initialize project when it is imported

I have an eclipse plugin and a custom project type. When the project is created through the wizard i can do as much setup code as i want. While using the plugin an .xml file is created containing plugin specific information about some resources inside the project.
Now when the project is checked into a versioning system the xml file is included. When someone checks out the project into eclipse again i would have to read the .xml file and apply the information to the resources again.
Is there a place where i can put code that is executed when a project of my custom project nature is beeing imported from somewhere else ?
You could use an IResourceChangeListener to listen for resource changes.
Your listener should get an IResourceDelta for the project with the 'kind' flag set to IResourceDelta.ADDED.

How to copy or share a linked folder from one project on another in Eclipse

I have a linked folder anyname in a Eclipse (Mars) project A (is a Dynamic Web Project). I created project B and want to also link anyname to it without starting from scratch. Stated other way, how do I copy the linked resource from A to B? Is there a way to configure anyname as a "global" shared linked folder and later include in other projects? anyname contains a standar in house classes and need to use it in several projects

How to set reference to the folder which contains multiple jar files?

My environment:
Netbean 6.9.1
Glassfish 3.0.1
Windows 7
Goal:
When my coworkers opens the Netbean Project, the library is already referenced without them manually create library, adding jars into it and reference it.
Detail:
I created Netbean project and the project has reference to few jar files in the folder.
Currently whoever opens the project for the first time, they have to manually create library and refer it to the project.
My project location:
C:\Users\masatosan\Desktop\myProject\myApp
My library location:
C:\Users\masatosan\Desktop\myProject\lib\myLib
The myLib folder contains:
some1.jar
some2.jar
some3.jar
I can achieve my goal if I create reference to individual jar file by defining to project.properties file like below: (creating reference to sqljdbc4.jar)
file.reference.sqljdbc4.jar=../lib/sqljdbc4.jar
javac.classpath=\
${libs.restlib_gfv3ee6.classpath}:\
${file.reference.sqljdbc4.jar}:
But my case is different since I have 3 jars in the myLib folder and wanting to reference them all.
Is it possible to reference all jars in myLib folder?
Please let me know if you need more clarification.
I'm sorry, but it doesn't work that way. When you create a project, you have to add the jar files individually.
However, if you put your lib folder under your project, netbeans will refer to them via relative paths. Then when you share the project (lib directory included), netbeans will be able to automatically find the jar files when the next person uses the project. That way you only have to add jar files once.
Short of using a dependency management tool like maven (which Netbeans has good support for), this is really the best solution. It uses a bit more disk space (obviously), but that's never been a huge issue for me.
I figured how so let me share.
Tool --> Library then library window pop up.
Create library called "MyLib" which contains multiple jars.
Add "MyLib" to your project. This change will be written to project.properties file under nbproject folder.
project.properties file indicates the classpath of lib reference you just added.
It should look like something below
javac.classpath=\
${libs.Excella.classpath}:\
${libs.MyLib.classpath}
Now someone else opens the project from different machine and she just needs to do step#1 and #2, which is to create library with same library name i.e. "MyLib"
I think this is what Bill was saying originally but thought it would be helpful to give step by step instructions since I finally figured .... after long time :D

Custom project structure in eclipse

I often use a eclipse plugins to quckliy generate project directory structure, for example Spring plugin helps to create WebContent folder to hold WEB-INF contents. But sometimes I create a projects with specific directory structure, always the same. Something like this:
[project_name]
-folder1
-folderA
-folderX
-folderB
-folder2
-dirC
-folder3
I know, that I can write my own ant/maven script to generate specific folders, but I don't want to manualy invoke scripts each time after project creating. I want to create a project template which I would use in the future.
What is the best way to create a this feature?
Should I create something like plugin? If yes, how would I do it?
If you don't want to use a plugin or a script to generate the project structure, you're pretty limited.
Since you can create a project from existing source, you could create the folder structure on your filesystem, and whenever you are creating another project, tell Eclipse to "Create Project from existing source" and point it to your template folder.
If you want to write a plugin, you'll want to contribute a org.eclipse.jdt.ui.actions.OpenProjectWizard that creates the folder structure as part of the project generation. A good tutorial can be found at: http://cvalcarcel.wordpress.com/2009/07/08/writing-an-eclipse-plug-in-part-1-what-im-going-to-do/%20
Maven has a concept of project templates called archetypes which is very similar to what you need. It defines the project structure, files, etc and can be customized upon creation.
If you install the Eclipse m2e maven plugin then you can create a new project from template with a few click
File / new Project / Maven project / Select archetype
You can use this feature even if you dont want to use maven later. You can auto generate ant scripts or anything like that. You can convert an exisint project into an archetype or create a new one from scratch, desciption is here
http://maven.apache.org/archetype/maven-archetype-plugin/
http://maven.apache.org/guides/mini/guide-creating-archetypes.html