Ilya,
Ignore my last message, I wasn't testing properly.
I think the issue is that you're most likely referencing the "db-migrate"
project before it's defined, e.g.,
task("deploy_local"=>[package(:war), jetty.use,
project("db-migrate").task("update")]) do |task|
...
end
If that's the case, I can think of two workarounds,
1) Use the Rake name instead of project(...):
task("deploy_local"=>[package(:war), jetty.use, "proj:db-migrate:update"])
do |task|
...
end
This approach doesn't require project "db-migrate" to have previously been
defined.
2) Once task("update") has been defined, add it as a dependency to
task("deploy_local"), e.g.,
task "update" do
...
end
project("proj:webui").task("deploy_local").enhance [task("update")]
Hope this helps,
alex
On Sun, Mar 13, 2011 at 10:55 AM, Alex Boisvert <[email protected]>wrote:
> Hi Ilya,
>
> I tried creating a fake project using your buildfile as a starting point
> but I'm unable to reproduce your issue. Any chance you could reduce it to
> something that can be packaged + executed independently? If not, can you
> post either the circular dependency chain and/or a complete log running your
> project with --trace:all --verbose options?
>
> alex
>
>
> On Sun, Mar 13, 2011 at 1:11 AM, Ilya Pyatigorskiy <[email protected]>wrote:
>
>> Hi,
>>
>> I'm looking at a best way to organise my project to avoid the subject.
>>
>> Currently I have:
>>
>> define "proj" do
>>
>> desc "main module that contains all the code (for now at least)"
>> define :webui do
>> compile.with GWT, PECTIN, HIBERNATE, GILEAD, SHIRO, SERVLET_API
>> test.with TEST
>> resources.from _("src/main/webapp")
>>
>> task("deploy_local"=>[package(:war), jetty.use]) do |task|
>> puts "Deploying webapp to a jetty instance"
>> Java.classpath.concat([
>> "org.mortbay.jetty:jsp-api-2.1:jar:#{Buildr::Jetty::VERSION}",
>> "org.mortbay.jetty:jsp-2.1:jar:#{Buildr::Jetty::VERSION}"
>> ])
>>
>> class << task ; attr_accessor :url, :path ; end
>> task.url = "http://localhost:8080"
>> task.path = jetty.deploy(task.url, task.prerequisites.first)
>> end
>>
>> task("run" => "deploy_local") do |task|
>> Readline::readline('[Type ENTER to stop Jetty]')
>> end
>>
>>
>> package(:war).include(gwt_dest, :as => ".").exclude("WEB-INF/deploy")
>> package(:war).libs -= artifacts(SERVLET_API)
>> unzip(_("target/root") => package(:war).to_s) # explode war if needed
>>
>> package(:jar) # so that dependant test projects can use the classes
>> end
>>
>> desc "database migration tool (based on liquibase)"
>> define "db-migrate" do
>> compile.with LIQUIBASE, LIQUIBASE_HIBERNATE, project("webui"),
>> project("webui").compile.dependencies
>> package(:jar)
>> manifest["Liquibase-Package"] = "ru.proj.db.migrate.liquibase"
>>
>> task "update" do
>> Java::Commands.java("liquibase.integration.commandline.Main",
>> "--changeLogFile=" +
>> project("proj:webui")._("src/main/resources/db/db.changelog-0.0.xml"),
>> "--logLevel=info",
>> "--driver=" + Buildr.settings.profile['jdbc']['drvr'],
>> "--url=" + Buildr.settings.profile['jdbc']['url'],
>> "--username=" + Buildr.settings.profile['jdbc']['user'],
>> "--password=" + Buildr.settings.profile['jdbc']['pass'],
>> ENV['cmd'].nil? ? "update" : ENV['cmd'],
>> {:classpath => [compile.dependencies, package(:jar)], :java_args =>
>> ["-Xmx256M"], :verbose=>true})
>> end
>> end
>>
>> desc "system tests that require database setup"
>> define "test-system" do
>> test.using :integration
>> test.with TEST_FUNC + projects("webui") +
>> project("webui").compile.dependencies
>>
>> # integration tests need app (jetty) to be running
>> integration.setup [project("db-migrate").task("update"),
>> project("proj:webui").task("deploy_local")]
>> end
>>
>> end
>>
>> so when i run "buildr integration" it causes
>> "test-system.integration.setup
>> => [db-migrate.update, webui.deploy_local]". This is acceptable, but I'd
>> like the webui.deploy_local to directly depend on db-migrate.update - this
>> sounds much more reasonable. But if i do that i'm getting a circular
>> dependency detected. How do i organize my tasks to avoid that?
>>
>> Thanks a lot!
>>
>
>