Unable to get custom component to work

When using Lucee, simply copying the component to /opt/lucee/tomcat/webapps/ROOT/WEB-INF/lucee/components would do the trick and the component would be available in my app. Trying to figure out where to copy the component for commandbox but I can’t seem to figure it out. Can someone help?


The folder exists for each server you start in CommandBox, but I would highly recommend against that approach. My rule of thumb is to not need to copy files around anywhere inside the guts of the CF home dir. Especially on CommandBox where the CF home is entirely managed for you and can be re-created at any time if you update the version of the engine you want. It’s just messy to be moving files into there.

To answer your original question, you can find the current CF engine home by right clicking on your started server’s tray icon and choosing “Open” > “Server Home” which will open it in Explorer. Or you can run the following command from the web root inside CommandBox:

server info property=serverHomeDirectory

You’ll find the Lucee server and web contexts inside the WEB-INF folder.

Now, what I would RECOMMEND you do, is use the this.componentpaths setting in your Application.cfc to just point to a folder of CFCs in your web root (or anywhere really) that you want to be in the lookup order.

this.componentPaths = expandPath( '/cfc/' );

and then you can create CFCs from that folder directly. This is a far more portable method of doing it which keeps your CFC files all neat and tidy inside of a source controlled web root.