Remove config.properties from your server jar project! Put it in src/main/resources of the war project (as you would for any Maven project).
/Anders On Fri, Mar 5, 2010 at 15:34, maven apache <[email protected]> wrote: > 2010/3/5 Anders Hammar <[email protected]> > > > Generally, read files from the classpath. > > So, remove the config.properties form your server project. For any unit > > tests you can put a config.properties under src/test/resources (will be > on > > the test class path). The add the config.properties to you war project so > > that it will be added to the webapp's class path. And there you go... Or, > > you might even want to keep the config.properties outside the war if you > > want to have different configuration for each environment. > > Yes, it is just why I did this. > But where should I put the config.properties in the war module. The > structures of my proect is : > > Server > --src/main/java > --ClassWhichUseTheConfigFile () //use the > XX.class.getResource("config.properties") > --config.poperties > --src/mainresourcs > > Web > --src/main/webapp > ....... > > > So if I put the file to Web(war) module, I may have to modify the manner to > get it. > > > > Your app server > > will likely have some folder where you can add config.properties so that > it > > ends up on the class path. > > > > /Anders > > > > On Fri, Mar 5, 2010 at 14:48, maven apache <[email protected]> > wrote: > > > > > HI: > > > I have two module Server(type of jar) and Web(type of war). > > > The Web module need Server, however in the Server module I need to read > > > something from a config file(config.properties), this file is put under > > the > > > Server module, and I do not want to this file packaged to the > server.jar > > > file, I want to it under the Web/WEB-INFO/classes . > > > So I use the maven-jar-plugin to exclude the config.properties, however > > > after I run "mvn clean install" , I found that the server.jar do not > > > contain > > > the config.properties( this is just I expected), however the file do > not > > > exist under the Web/WEB-INFO/classes. > > > So I want to know if there are any ways to implement my requirement? > > > > > >
