What exactly is the reason for putting the applications configuration in a separate JAR? Is it to wrap the configuration for all modules into a single jar, and then all modules retrieve their configurations from it. I figure this way you don't need to extract+repackage each JAR when you want to reconfigure it.
I guess how I would do it is to add a class to the config JAR which is used to retrieve the configuration resources. Something like MyConfig.retrieveConfig("project1", "data.xml") - or something like that. Then you can just have all projects depend on this configuration JAR and retrieve their configurations through this interface. The benefit of this is that you can put configuration overrides in this retrieveConfig() method. Like, it would check if {system-config-directory}/myproject/project1/data.xml exists and if it does use it, and if it doesn't default to using the one inside the JAR. So, to summarize. If you want to put all your configurations in a JAR, do so but retrieve the configuration not directly but through an exposed interface. Then also do your paths and resources layout by a given set of rules (like META-INF/{project-name}/{resource-name} or whatever). And document this library.To put this into Maven, you merely have to define the config JAR as a dependency to the project that wants to use it. So if lib-project2 wants to access configuration, then your config JAR artifact needs to become a dependency of lib-project2. If project1 needs it, then it also becomes a dependency of it. You can also look into something like commons-configuration or Spring to manage your configurations. Quintin Beukes On Sun, Oct 18, 2009 at 2:03 PM, Anders Hammar <and...@hammar.net> wrote: > I pretty much boils down to your requirements. Loading from the classpath is > IMO the right way to do things. However, if you need to keep the config > files in a separate project, or just have them in the same project where you > read them, depends on your needs. I would not have a separate config project > unless there are any specific requirement forcing meto do so. I'd just put > the resource files in lib-project2. > > Your module tree looks strange. Where would lib-project2 be in it? > > /Anders > > On Sat, Oct 17, 2009 at 18:27, _MS_ <matija.slivo...@gisdata.com> wrote: > >> >> I have project consisting of several modules. >> >> One of the modules requires configuration and loads it through >> Class.getResource native call. >> Configuration is packaged in jar archive on classpath. >> >> What is best practice of doing this in maven2. >> >> For example. >> >> project1 >> |- >> |-config.jar >> >> lib-project2 >> >> project1 depends on lib-project2. Lib project loads configuration from >> classpath. >> >> >> -- >> View this message in context: >> http://www.nabble.com/Config.jar-project-dependency-tp25939781p25939781.html >> Sent from the Maven - Users mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org >> For additional commands, e-mail: users-h...@maven.apache.org >> >> > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org