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<[email protected]>:
I'm running the tomcat plugin configured as follows:

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>tomcat-maven-plugin</artifactId>
        <configuration>

  <warSourceDirectory>${basedir}/src/main/webapp</warSourceDirectory>
        </configuration>
      </plugin>

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
<warSourceDirectory>  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: [email protected]
For additional commands, e-mail: [email protected]






---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to