Command cannot be found in the prime directory despite it's in prime directory


I’ve created a snap for gradle. The snapcraft.yml file works fine when base is core20. However it shows the following error when I switch to core18:

Copying needed target link from the system /etc/ssl/certs/java/cacerts                                                                                                                                                                                                            
Pulling java                                                                                                                                                                                                                                                                      
Building gradle                                                                                                                                                                                                                                                                   
Building java                                                                                                                                                                                                                                                                     
Staging gradle                                                                                                                                                                                                                                                                    
Staging java                                                                                                                                                                                                                                                                      
Priming gradle                                                                                                                                                                                                                                                                    
Priming java                                                                                                                                                                                                                                                                      
The command 'opt/gradle/bin/gradle' was not found in the prime directory, it has been changed to '/bin/sh'.
A shell wrapper will be generated for command '/bin/sh $SNAP/opt/gradle/bin/gradle' as it does not conform with the command pattern expected by the runtime. Commands must be relative to the prime directory and can only consist of alphanumeric characters, spaces, and the following special characters: / . _ # : $ -

When I debug the snapping process (by snapcraft prime gradle --shell-after --debug) I can see that prime/org/gradle/bin/gradle exists. The exact YML is here:


Any ideas?

That’s a confusing warning that we need to clean up. You should be able to just ignore it. I assume it runs OK?

1 Like

Yes, it works. I had other issues with devmode which led me to think that it doesn’t work because of this. Using base core20, I do not see this warning btw.