I am currently using IntelliJ IDEA to build my project, but I want to move away from it to break the dependency on this particular IDE. Buildr looks like a nice option since 1) it is simple, and 2) I already know Ruby.
My IDEA project, which is for a Java library, currently looks something like this:
/
/src/...
/sample_applications/
I can build my library as a JAR with a target like this with no issues:
define 'my_library' do
project.version = '0.0.1'
package(:jar)
end
But I'd like to provide build targets for the sample applications--which depend on my_library
--using the same buildfile. If I create another target like so:
sample_layout = Layout.new
sample_layout[:source, :main, :scala] = 'sample_programs/simple_program.scala'
define 'simple_program', :layout => sample_layout do
project.version = '0.0.1'
package(:jar)
end
simple_program-0.0.1.jar
is compiled just fine, but the my_library
JAR is not included. If I include it by modifying the above definition to:
define 'simple_program', :layout => sample_layout do
project.version = '0.0.1'
package(:jar).path("lib").tap do |p|
p.include artifact('my_library').to_s
end
end
Then I get an error like: RuntimeError : Missing artifact identifier for {:group=>"my_library"}
How can I refer to a JAR I made earlier in another project in the same buildfile?
This is a simple issue, you just need to tell Buildr that the package task requires building the jar from the other project:
package(:jar).include( project('my_library').package(:jar), :as => "lib/my_library.jar" )