When you run rake package
(without previously running anything else to create any needed files) Rake sees that the package task needs the file target/library.jar
. Since this file doesn’t yet exist Rake checks to see if it knows how to create it. It doesn’t know of any rules that will create this file, so it fails with the error you see.
Rake does have a task that it thinks will create a file named package_jar
, and that task in fact creates the file target/library.jar
, but it doesn’t realise this.
The fix is to tell Rake exactly what file is created in the file
task. Rake will then automatically find the dependency.
Change
file :package_jar => [:compile] do
to
file 'target/library.jar' => [:compile] do
and then remove the line
task :package => :package_jar
since package_jar
no longer exists and Rake will find the dependency on the file by itself.