Re: [Tomcat Plugin] WebAppSourceDirectory Configuration?
Maybe - But I'm using DWR to invoke methods on my application layer. I'm not going directly through a servlet. So now my code needs to get the servletContext, which is not a big deal, but it means adding code that's only there for the reason of testing the application layer. I'd rather change the resource paths between testing and production, than make the application more complex. Thanks for all the tips and trying though, - Ole - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: [Tomcat Plugin] WebAppSourceDirectory Configuration?
servletContext.getResourceAsStream("WEB-INF/data/somedata.xml") ? 2011/10/11 Ole Ersoy : > Hi, > > I believe this forces me to change the location of the web apps data files. > Right now they are located under WEB-INF/data/somedata.xml. So if I use a > ContextClassLoader then I have to change the location of the files when the > webapp is deployed in production right? > > Thanks, > - Ole > > On 10/11/2011 03:25 AM, Olivier Lamy wrote: >> >> Hello, >> Why not simply put your resources in src/main/resources and load it >> with Thread.currentThread().getContextClassLoader().getResourceAsStream( >> path in classloader ) ? >> >> 2011/10/11 Ole Ersoy: >>> >>> Maybe if i explain what I'm trying to do, it will make more sense. I >>> have a >>> maven webapp project. I'm running it with: >>> >>> mvn tomcat:run >>> >>> When I run the webapp I would like to load resources from >>> "WEB-INF/resources/...". When running a webapp in a standalone >>> container >>> "WEB-INF" is located in the "root" folder. However because I'm using >>> maven >>> to run the webapp, the "WEB-INF" folder is located under >>> "src/main/webapp". >>> Therefore if I want to test resource loading I need to add >>> "src/main/webapp" to the path of the resource when running with: >>> mvn tomcat:run. >>> >>> So for example running with "mvn tomcat:run" I have to load >>> myresource.xml >>> like this: >>> application.load("src/main/webapp/WEB-INF/resources/myresource.xml"); >>> >>> However when deploying in a standalone container the same resource would >>> be >>> loaded like this: >>> application.load("WEB-INF/resources/theresource.xml"); >>> >>> I'm trying to avoid having to change my application configuration for >>> testing in a standalone container and testing with: >>> mvn tomcat:run >>> >>> Does that make sense? >>> >>> Thanks, >>> - Ole >>> >>> >>> On 10/10/2011 04:26 PM, Olivier Lamy wrote: 2011/10/10 Ole Ersoy: > > I'm running the tomcat plugin configured as follows: > >>> >>> org.codehaus.mojo >>> tomcat-maven-plugin >>> >>> >>> ${basedir}/src/main/webapp >>> >>> > > If I run the following line from a servlet the application is running: > logger.trace("The current root directory is: {} ", new > File("").getAbsolutePath()); > > I would expect to see "The current root directory is: > ${basedir}/src/main/webapp". However the result is: > "The current root directory is: ${basedir}". In other words it seems > the > configuration has not taken effect. you should read current root webapp directory in the servlet container. this means if you go with your browser to http://localhost:${port}/ you will see files from this directory. > > Thoughts? TIA, > - Ole > > - > 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 >>> >>> >> >> >> > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > > -- Olivier Lamy Talend : http://talend.com http://twitter.com/olamy | http://linkedin.com/in/olamy - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: [Tomcat Plugin] WebAppSourceDirectory Configuration?
Hi, I believe this forces me to change the location of the web apps data files. Right now they are located under WEB-INF/data/somedata.xml. So if I use a ContextClassLoader then I have to change the location of the files when the webapp is deployed in production right? Thanks, - Ole On 10/11/2011 03:25 AM, Olivier Lamy wrote: Hello, Why not simply put your resources in src/main/resources and load it with Thread.currentThread().getContextClassLoader().getResourceAsStream( path in classloader ) ? 2011/10/11 Ole Ersoy: Maybe if i explain what I'm trying to do, it will make more sense. I have a maven webapp project. I'm running it with: mvn tomcat:run When I run the webapp I would like to load resources from "WEB-INF/resources/...". When running a webapp in a standalone container "WEB-INF" is located in the "root" folder. However because I'm using maven to run the webapp, the "WEB-INF" folder is located under "src/main/webapp". Therefore if I want to test resource loading I need to add "src/main/webapp" to the path of the resource when running with: mvn tomcat:run. So for example running with "mvn tomcat:run" I have to load myresource.xml like this: application.load("src/main/webapp/WEB-INF/resources/myresource.xml"); However when deploying in a standalone container the same resource would be loaded like this: application.load("WEB-INF/resources/theresource.xml"); I'm trying to avoid having to change my application configuration for testing in a standalone container and testing with: mvn tomcat:run Does that make sense? Thanks, - Ole On 10/10/2011 04:26 PM, Olivier Lamy wrote: 2011/10/10 Ole Ersoy: I'm running the tomcat plugin configured as follows: org.codehaus.mojo tomcat-maven-plugin ${basedir}/src/main/webapp If I run the following line from a servlet the application is running: logger.trace("The current root directory is: {} ", new File("").getAbsolutePath()); I would expect to see "The current root directory is: ${basedir}/src/main/webapp". However the result is: "The current root directory is: ${basedir}". In other words it seems the configuration has not taken effect. you should read current root webapp directory in the servlet container. this means if you go with your browser to http://localhost:${port}/ you will see files from this directory. Thoughts? TIA, - Ole - 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 - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: [Tomcat Plugin] WebAppSourceDirectory Configuration?
Hello, Why not simply put your resources in src/main/resources and load it with Thread.currentThread().getContextClassLoader().getResourceAsStream( path in classloader ) ? 2011/10/11 Ole Ersoy : > Maybe if i explain what I'm trying to do, it will make more sense. I have a > maven webapp project. I'm running it with: > > mvn tomcat:run > > When I run the webapp I would like to load resources from > "WEB-INF/resources/...". When running a webapp in a standalone container > "WEB-INF" is located in the "root" folder. However because I'm using maven > to run the webapp, the "WEB-INF" folder is located under "src/main/webapp". > Therefore if I want to test resource loading I need to add > "src/main/webapp" to the path of the resource when running with: > mvn tomcat:run. > > So for example running with "mvn tomcat:run" I have to load myresource.xml > like this: > application.load("src/main/webapp/WEB-INF/resources/myresource.xml"); > > However when deploying in a standalone container the same resource would be > loaded like this: > application.load("WEB-INF/resources/theresource.xml"); > > I'm trying to avoid having to change my application configuration for > testing in a standalone container and testing with: > mvn tomcat:run > > Does that make sense? > > Thanks, > - Ole > > > On 10/10/2011 04:26 PM, Olivier Lamy wrote: >> >> 2011/10/10 Ole Ersoy: >>> >>> I'm running the tomcat plugin configured as follows: >>> > > org.codehaus.mojo > tomcat-maven-plugin > > > ${basedir}/src/main/webapp > > >>> >>> If I run the following line from a servlet the application is running: >>> logger.trace("The current root directory is: {} ", new >>> File("").getAbsolutePath()); >>> >>> I would expect to see "The current root directory is: >>> ${basedir}/src/main/webapp". However the result is: >>> "The current root directory is: ${basedir}". In other words it seems the >>> configuration has not taken effect. >> >> you should read current root webapp directory in the servlet container. >> >> this means if you go with your browser to http://localhost:${port}/ >> you will see files from this directory. >> >>> >>> Thoughts? TIA, >>> - Ole >>> >>> - >>> 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 > > -- Olivier Lamy Talend : http://talend.com http://twitter.com/olamy | http://linkedin.com/in/olamy - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: [Tomcat Plugin] WebAppSourceDirectory Configuration?
Maybe if i explain what I'm trying to do, it will make more sense. I have a maven webapp project. I'm running it with: mvn tomcat:run When I run the webapp I would like to load resources from "WEB-INF/resources/...". When running a webapp in a standalone container "WEB-INF" is located in the "root" folder. However because I'm using maven to run the webapp, the "WEB-INF" folder is located under "src/main/webapp". Therefore if I want to test resource loading I need to add "src/main/webapp" to the path of the resource when running with: mvn tomcat:run. So for example running with "mvn tomcat:run" I have to load myresource.xml like this: application.load("src/main/webapp/WEB-INF/resources/myresource.xml"); However when deploying in a standalone container the same resource would be loaded like this: application.load("WEB-INF/resources/theresource.xml"); I'm trying to avoid having to change my application configuration for testing in a standalone container and testing with: mvn tomcat:run Does that make sense? Thanks, - Ole On 10/10/2011 04:26 PM, Olivier Lamy wrote: 2011/10/10 Ole Ersoy: I'm running the tomcat plugin configured as follows: org.codehaus.mojo tomcat-maven-plugin ${basedir}/src/main/webapp If I run the following line from a servlet the application is running: logger.trace("The current root directory is: {} ", new File("").getAbsolutePath()); I would expect to see "The current root directory is: ${basedir}/src/main/webapp". However the result is: "The current root directory is: ${basedir}". In other words it seems the configuration has not taken effect. you should read current root webapp directory in the servlet container. this means if you go with your browser to http://localhost:${port}/ you will see files from this directory. Thoughts? TIA, - Ole - 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
Re: [Tomcat Plugin] WebAppSourceDirectory Configuration?
2011/10/10 Ole Ersoy : > I'm running the tomcat plugin configured as follows: > >>> >>> org.codehaus.mojo >>> tomcat-maven-plugin >>> >>> >>> ${basedir}/src/main/webapp >>> >>> > > If I run the following line from a servlet the application is running: > logger.trace("The current root directory is: {} ", new > File("").getAbsolutePath()); > > I would expect to see "The current root directory is: > ${basedir}/src/main/webapp". However the result is: > "The current root directory is: ${basedir}". In other words it seems the > configuration has not taken effect. you should read current root webapp directory in the servlet container. this means if you go with your browser to http://localhost:${port}/ you will see files from this directory. > > Thoughts? TIA, > - Ole > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > > -- Olivier Lamy Talend : http://talend.com http://twitter.com/olamy | http://linkedin.com/in/olamy - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: [Tomcat Plugin] WebAppSourceDirectory Configuration?
I'm running the tomcat plugin configured as follows: org.codehaus.mojo tomcat-maven-plugin ${basedir}/src/main/webapp If I run the following line from a servlet the application is running: logger.trace("The current root directory is: {} ", new File("").getAbsolutePath()); I would expect to see "The current root directory is: ${basedir}/src/main/webapp". However the result is: "The current root directory is: ${basedir}". In other words it seems the configuration has not taken effect. Thoughts? TIA, - Ole - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: [Tomcat Plugin] WebAppSourceDirectory Configuration?
2011/10/9 Ole Ersoy : > Hi, > > I tried the following: > > > org.codehaus.mojo > tomcat-maven-plugin > > ${basedir}/src/main/webapp > > > > However when I run the following from my code: > logger.trace("The current root directory is: {} ", new > File("").getAbsolutePath()); > > I still get the root directory of the project. Thoughts? I don't follow you here. You are running the plugin or doing something within a home made plugin ? > > TIA, > - Ole > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > > -- Olivier Lamy Talend : http://talend.com http://twitter.com/olamy | http://linkedin.com/in/olamy - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: [Tomcat Plugin] WebAppSourceDirectory Configuration?
Hi, I tried the following: org.codehaus.mojo tomcat-maven-plugin ${basedir}/src/main/webapp However when I run the following from my code: logger.trace("The current root directory is: {} ", new File("").getAbsolutePath()); I still get the root directory of the project. Thoughts? TIA, - Ole - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: [Tomcat Plugin] WebAppSourceDirectory Configuration?
Cool - Thanks! - Ole On 10/09/2011 12:39 PM, Olivier Lamy wrote: Check warSourceDirectory parameter. http://mojo.codehaus.org/tomcat-maven-plugin/run-mojo.html#warSourceDirectory 2011/10/9 Ole Ersoy: Hi, Is it possible to configure the "WebAppSourceDirectory" in the Tomcat Plugin? I'm looking at the Jetty plugin documentation ( http://wiki.eclipse.org/Jetty/Feature/Jetty_Maven_Plugin ), and it seems it has a webAppSourceDirectory that is set to ${basedir}/src/main/webapp, which is the behaviour would like. TIA, - Ole - 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
Re: [Tomcat Plugin] WebAppSourceDirectory Configuration?
Check warSourceDirectory parameter. http://mojo.codehaus.org/tomcat-maven-plugin/run-mojo.html#warSourceDirectory 2011/10/9 Ole Ersoy : > Hi, > > Is it possible to configure the "WebAppSourceDirectory" in the Tomcat > Plugin? I'm looking at the Jetty plugin documentation ( > http://wiki.eclipse.org/Jetty/Feature/Jetty_Maven_Plugin ), and it seems it > has a webAppSourceDirectory that is set to ${basedir}/src/main/webapp, which > is the behaviour would like. > > TIA, > - Ole > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > > -- Olivier Lamy Talend : http://talend.com http://twitter.com/olamy | http://linkedin.com/in/olamy - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org