Maven plugin loading migrations from classpath instead of filesystem?

3 views
Skip to first unread message

Kristof Jozsa

unread,
Mar 22, 2009, 4:23:31 AM3/22/09
to Carbon Five DB Migration Discussion Group
Hi all,

I'd like to ask for an enhancement. I'd love to use c5-db-migrations
with maven but load migrations from the maven classpath instead of the
filesystem.

The basic usage scenario is having a root pom where c5-db-migrations
is configured and which also depends on the artifact holding the
migration scripts. Therefore, all child-project developers could
automatically use c5-db-migrations to execute the default migration
scripts, plus, their own scripts from the child project's classpath
could easily merge with the default scripts..

I never hacked on a maven plugin myself (nor am I familiar with maven
plugins' classpath issues), but for me it seems that
AbstractMigrationMojo's line 137 is responsible for defaulting to a
file-based search.. Could you please change line 135 from:

if (!(migrationsPath.startsWith("/") || migrationsPath.startsWith
("\"")))
to
if (!(migrationsPath.startsWith("/") || migrationsPath.startsWith
("\"") || migrationsPath.startsWith("classpath:")))

so the Spring Resource API's classpath: prefix could be applied to
this scenario? I'm not sure if it could work this way, I'll have to
get back tomorrow to the office to try it out..

If it's not a correct (or preferred) way to accomplish the task, I'm
still open for suggestions how to do it.

thanks for your work on c5dbmig..
cheers,

Kristof Jozsa
Reply all
Reply to author
Forward
0 new messages