Iam using Jenkins to build my project. In build.xml, I have written the following code to copy the files from src to dest folder...
<copydir src="../image_files/Ace/drawable-hdpi" dest="../IgnitorACE/res/drawable-hdpi"/>
The problem is that, in src having the only two image files with same name as in dest folder but the pattern/design of images are differnt. So, whenever i run my build, jenkins has to copy and replace the image files with new image but same name.
The above command is working but getting warning as
[copydir] DEPRECATED - The copydir task is deprecated. Use copy instead.
[copydir] Copying 2 files to /var/lib/jenkins/workspace/Ace Build/IgnitorACE/res/drawable-hdpi
So, any solution will be appreciated.
Thanks
As the warning clearly states that [copydir] DEPRECATED - The copydir task is deprecated. Use copy instead, you should use copy instead of copydir command.
So, instead of
<copydir src="../image_files/Ace/drawable-hdpi" dest="../IgnitorACE/res/drawable-hdpi"/>
use
<copy file="../image_files/Ace/drawable-hdpi" tofile="../IgnitorACE/res/drawable-hdpi"/>
Also go through the official link for more details.
Related
I have directory csv in context directory of docker build. I want to copy it into docker image in all circumstances (for empty directory in host an empty directory inside image is created, for nonempty directory in host it is copied with all content).
The COPY csv/* /csv/ gives COPY failed: no source files were specified error when the directory is empty.
Similar questions I found on SO are differing from my case in either setup or intention (multistage build, copying existing jar, certainly existing file) so I choose Q&A-style here rather than messing question with unrelated answer. This Github issue is also related.
The solution is to use
COPY csv/. /csv/
This question gave me a hint (although the behavior desired by me is unwanted for its OP).
I am trying to copy a jar file in my dockerfile. whne I run build, I can see the jar under target/dockerbuild. But docker does not see the file and I am getting following error.
COPY failed: no source files were specified
My docker file has those lines for copy operation:
ENV MY_HOME=/usr/local/myhome
COPY target/dockerbuild/my.jar $MY_HOME
Why it cannot find the jar although it exists under the target.
Verify that in your .dockerignore do not have that path (target) in your exceptions
Your error looks like it could be one of the following:
The file doesn't exist in the specified path
The path doesn't exist (relative to the build context - if you use 'docker build .' then the specified path must exist relative to the current directory)
Please can you share what you run to build your docker image (so we can see the build context) and also your directory structure
That error said file target/dockerbuild/my.jar is not exist. The architecture of COPY in Dockerfile is:
COPY {file in your host} {path of target in docker image}
I had a very similar situation.
ls target/dockerbuild/my.jar
proofed that the file exists but docker build claimed that no source files were specified. However there also was a tiny hint that I did not notice for some time:
When using COPY with more than one source file, the destination must be a directory and end with a /
Though I only had one file I added the / to the copy destination and the build succeeded.
in my dockerfile I have these two lines:
ADD /ansible/inventory /etc/ansible/hosts
ADD /ansible/. /ansiblerepo
The first line works, as I can run the container and see my hosts file has been populated with all the ips from my inventory file.
The second line doesn't appear to be working though. I'm just trying to copy all the files/subdirectories of ansible and copy them over to the ansiblerepo directory inside the new container.
There are no errors while building the image, but again ansiblerepo is just an empty directory and nothing has copied over to it. I assume I'm just missing a back slash or something.
Docker ADD and COPY commands work relative to the build directly, and only for files in that directory that weren't excluded with a .dockerignore file. The reason for this is that builds actually run on the docker host, which may be a remote machine. The first step of a docker build . is to package up all the files in the directory (in this case .) and send them to the host to run your build. Any absolute paths you provide are interpreted as relative to the build directory and anything you reference that wasn't sent to the server will be interpreted as a missing file.
The solution is to copy /ansible to your build directory (typically the same folder as your Dockerfile).
Make sure that in your ".dockerignore" file, it does not excluded everything. usually, dockerignore file has these lines
*
!obj\Docker\publish\*
!obj\Docker\empty\
this means that everything is ignored except publish and empty folders.
Removing trailing /. from source directory should fix the ADD command.
On a related note, Docker Best Practices suggest using COPY over ADD if you don't need the URL download feature.
I am creating a docker file based on cl0sey/dotnet-mono-node-docker:latest to build my .NET Core solution. The solution folder is under a folder called src.
When I execute
dotnet restore -s https://api.nuget.org/v3/index.json
I get no exception, all seems to go well and I get the corresponding verification for all projects that the project.lock.json files have been created, like
log : Writing lock file to disk. Path:
/build/src/CoreLibrary/src/CoreWeb/project.lock.json
, but when I invoke
dotnet build ./src/**/project.json -c Release
I get the following error:
Project x does not have a lock file. Please run "dotnet restore" to
generate a new lock file.
I've checked with find . -type f and found that the lock files are indeed missing, despite the trace message stated otherwise. Interestingly if I do the very same steps on my local windows, it works like a charm.
Update: I experience the same behavior using microsoft/dotnet:latest as a base image.
I have a script which converts wav files to caf files, and I'd like to get them copied to my iOS app automatically. The script looks like this:
Xcode doesn't copy it automatically, and i can't find a way to add it to my Copy Build Phase section. It appears that I need to add a line in the script to copy it directly to the app bundle, or to make the destination the app bundle itself.
What would that script/change be? I'm not sure what shell vars to use for the cp command.
Thanks - Henry
The environment variable you're looking for is "BUILT_PRODUCTS_DIR" and you can find the definition of this, and plenty of other useful Xcode-specific environment variables on this handy Apple documentation page.
And what you'd probably want to do is test for the existence of successfully converted files, and if they exist, then copy those files into the "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}" directory.