How do I exclude a file from copying in DockerImageStepTask?

Jenkins build is failing due to the failure of the step, "DockerImageStepTask".

The exact error is specified below :

Step 11/15 : COPY ${modulePath}/${artifactPath}/*${optionalJarSuffix}.jar /opt/test/test.jar
Could not build image: COPY failed: no source files were specified

Do I need to add anything in my .gitignore file on my GitHub repo or do I need to add a Dockerfile for fixing this ? If yes, can someone tell me what exactly needs to be added into the file ?
How can I exclude this step (or this file) from copying ? Kindly help. Thanks.

Source: Docker Questions