If you are really just trying to upload a single file, VLT is probably not the right tool for you. Just use curl:
curl -TC:\main\remote\localhost_4502\jcr_root\apps\vdc\test.txt -u admin:admin http://localhost:4502/apps/vdc/test.txt
Your suggestion is very useful to me.
My primary purpose is achieving this goal:
1.Maintaining a CQ5 project by more than one person, and there're no code conflict. So we need a version control system.
2.Developing by using Eclipse, the reason is that Eclipse is very powerful, but how to integrate Eclipse with CRXDE Lite, just like Eclipse and Tomcat, when I save the code, it will be synchronized to CRXDE Lite automatically, if we don't use VLT, whether can we do that?
I'm sorry for my poor English, I don't know whether I express myself intelligibly. Thank you!
1 person found this helpful
You should use VLT for this, but not import (at least not in day to day operation). When you make a change in Eclipse, run "vlt commit" on the command line to push the changed file into your CRX repository. If there's a new file, run "vlt add <file>", then "vlt commit". If you're removing a file, run "vlt rm <file>" then "vlt commit".
I believe there are ways to hook this into Eclipse as some kind of automatically running external tool, but I don't know the details of this.
import and export are very coarse grained operations. commit (and, conversly update) only deal with the files that have changed. You do need to use import when you are first setting up a project. Usually, the first developer does a checkout from their local repository, then an import into version control and then subsequent developers do a checkout from version control, an import into their local repository, and then a checkout to set up the VLT working copy.
There's also a new "sync" feature available in some versions of vlt which runs as a background process keeping a working copy and repository structure in sync with each other. I'd suggest contacting DayCare if you are interested in this.
Be sure to read http://dev.day.com/docs/en/crx/current/how_to/how_to_use_the_vlttool.html, especially the section about a filtered checkout.
I only have another question to consult you, if I commit a java file by VLT or curl, whether can CQ5 compile automatically?
CQ supports Java as a scripting language. This isn't as commonly used as JSP or ESP. You'll see an example here: /libs/foundation/components/parbase/img.GET.java
In this case, if you update the java file using vlt, it'll be recompiled (just like a JSP).
If you are talking about code in an OSGi bundle, just updating the file won't cause the bundle to be recompiled. You should use a CI server for this.
I really appreciate your help. Thanks!
I know CRXDE Lite has a functionality of create bundle, it runs within a browser, so when I create bundle by CRXDE Lite, the browser just makes a http request, so do you think it's possible to simulate this request by "curl"?
I'm sure this is possible. I'd suggest using something like Firebug to capture the HTTP request.
I have found that the command "import" of vlt can only import all project, even the directory is not permitted.
Are there any way to upload whole directory and create it on JCR remotely without file .vlt?
I think that curl is very useful for uploading a single file, however, it cannot upload the whole directory or create it.
If you are using Eclipse, VaultClipse is a tool that might help you. You can create your content structure inside Eclipse and use VaultClipse to Import and Export it.
Otherwise, I've also seen people create simple forms that make requests against the Sling REST API, but it's kind of clunky and not very reusable.