Inserting a plugin after DBPlugin but before JPAPlugin

152 views
Skip to first unread message

Mathias Bogaert

unread,
Oct 27, 2010, 7:05:18 AM10/27/10
to play-framework
Hi,

I'm trying to integrate Flyway (http://code.google.com/p/flyway/) in
my project, as a PlayPlugin:

public class FlywayMigrationPlugin extends PlayPlugin {
public void onApplicationStart() {
Flyway flyway = new Flyway();
flyway.setDataSource(DB.datasource);
flyway.migrate();
}
}

But since the plugin priorities (in play.plugins) have no
'gaps' (DBPlugin is 3, JPAPlugin 4) I'm stuck. I know I can change the
play.plugins, but I'm wondering if there is any other solution.
Thanks!

Mathias

Guillaume Bort

unread,
Oct 27, 2010, 1:19:03 PM10/27/10
to play-fr...@googlegroups.com
No, I should add more space between plugin numbers. I'll fix that.

> --
> You received this message because you are subscribed to the Google Groups "play-framework" group.
> To post to this group, send email to play-fr...@googlegroups.com.
> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
>
>

--
Guillaume Bort, http://guillaume.bort.fr

For anything work-related, use g...@zenexity.fr; for everything else,
write guillau...@gmail.com

GrailsDeveloper

unread,
Oct 27, 2010, 1:32:39 PM10/27/10
to play-framework
Can we say that all priorities < 1000 are reserved for the framework
and should only be used if there are reasons why a plugin must run
before another plugin. Then we could have wide spaces between the
numbers. The problem we has with this is, that some other plugins can
become broken because the JPAPlugin get a to high number.

I want to suggest another idea:
Making it possible to overwrite the numbers, this can be done by one
masterplay.plugins or if we make sure that a plugin will only be
loaded once and say that first a play.plugins in the conf-folder of
the app will be read.

Last but not least I think the compareTo should be fixed
http://play.lighthouseapp.com/projects/57987/tickets/121. If you add
the plugin name to compareTo it will allow a quick hack. This give us
time to think a little bit more about a good solution for plugin
dependencies and ordering.

Niels
> Guillaume Bort,http://guillaume.bort.fr
>
> For anything work-related, use g...@zenexity.fr; for everything else,
> write guillaume.b...@gmail.com

Guillaume Bort

unread,
Oct 27, 2010, 1:45:35 PM10/27/10
to play-fr...@googlegroups.com
> The problem we has with this is, that some other plugins can
> become broken because the JPAPlugin get a to high number.

Yes it's possible but I prefer doing it right now, before having too
much contributed modules/plugins.

So I've changed for:

0:play.CorePlugin
100:play.data.parsing.TempFilePlugin
200:play.data.validation.ValidationPlugin
300:play.db.DBPlugin
400:play.db.jpa.JPAPlugin
500:play.i18n.MessagesPlugin
600:play.libs.WS
700:play.jobs.JobsPlugin

And I'll add a note in the release notes.

> For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
>
>

--
Guillaume Bort, http://guillaume.bort.fr

For anything work-related, use g...@zenexity.fr; for everything else,

write guillau...@gmail.com

GrailsDeveloper

unread,
Oct 27, 2010, 3:08:16 PM10/27/10
to play-framework
With fixing http://play.lighthouseapp.com/projects/57987/tickets/121
you could provide a solution for now and get time to solve the problem
in 1.2. For 1.1 you could add a note that module priorities should be
greater than 1000, so that you have there the possibilities without
any problems.
But if you are sure that you don't want to solve the dependency-issue
with a smarter, but complexer solution, the change now is quite good.

Niels
Reply all
Reply to author
Forward
0 new messages