1

I have a custom structure inside main/defaut/classes

enter image description here

The classes where created in these custom folders. When i try to retrieve metadata with:

sfdx force:source:retrieve --sourcepath ...\force-app\main\default\classes

The existing classes are not updated, but created again in the root directory \force-app\main\default\classes

2
  • Looks like you are using the falcon-template. Please see this the selected answer especially the section What is the "Default Package Directory" and why is it special? and see if that answers your question. The default retrive always fetches into the default source directory/classes folder.
    – manjit5190
    Commented Jul 29, 2020 at 13:47
  • It's the standard sfdx project template. But i created new folders in classes directory of default package. Until then, when retrieving, files were updated within this customized structure, for example : force-app\main\default\classes\Application\Controller\ContactsController. Now it is going to the root of the classes folder
    – vrr
    Commented Jul 29, 2020 at 13:53

1 Answer 1

2

This is a bug and you can try the alm pre version by using below for a temporary fix

sfdx plugins:install salesforce-alm@mpd

Look for updates to the CLI in the coming days.

Also make sure to follow below guidelines

Source path in your command has to be the exact path as your class name.

Try this

sfdx force:source:retrieve --sourcepath force-app\main\default\classes\Application\Controller\ContactsController

The other would be not using the path and use the name like below

sfdx force:source:retrieve -m "ApexClass:ContactsController"
5
  • I need to retrieve the entire directory, as the project is versioned and there may be changes in several files.
    – vrr
    Commented Jul 29, 2020 at 14:35
  • Just use the directory name as shown in first example! Remove the class name and use the right directory name and it will retrieve to the right folder! Commented Jul 29, 2020 at 14:36
  • Thus, all classes are duplicated at the root of the "classes" folder, and not updated in the appropriate directories within "classes" of which the files already exist. Instead of the file being updated in: classes \Application\Controller\ContactsController A new file is created at: classes\ContactsController
    – vrr
    Commented Jul 29, 2020 at 14:44
  • Try the new version of alm package! I updated the answer! I think this is a bug and we have a pre release plugin to fix it for now Commented Jul 29, 2020 at 14:52
  • 1
    Worked! Thank you :)
    – vrr
    Commented Jul 30, 2020 at 14:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .