title: Unable to load external spring config files with jetty maven plugin
body: <p>I try to launch a webapp with jetty-maven-plugin as in <a href="http://wiki.eclipse.org/Jetty/Feature/Jetty_Maven_Plugin" rel="nofollow noreferrer">http://wiki.eclipse.org/Jetty/Feature/Jetty_Maven_Plugin</a>. But I want to externalize my environment configuration files.
  Here is my project hierachy:</p>
  
  <pre><code>myapp-webapp
  - src
  - - test
  - - - ressources
  - - - java
  - - main
  - - - ressources
  - - - java
  - - - webapp
  - - - - WEB-INF
  - - - - META-INF
  - - - - templates
  - - - - ressources
  - - - - index.xhtml
  + target (I don't detail it)
  - configuration
  - - local
  - - - databaseLocal.properties
  - - - ... others config files
  - - dev
  - - test
  - - prod
  </code></pre>
  
  <p>And here is my pom file:</p>
  
  <pre><code>&lt;profiles&gt;
      &lt;profile&gt;
      &lt;id&gt;myapp-work&lt;/id&gt;
      &lt;activation&gt;
          &lt;property&gt;
              &lt;name&gt;!env&lt;/name&gt;
          &lt;/property&gt;
      &lt;/activation&gt;
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.mortbay.jetty&lt;/groupId&gt;
                  &lt;artifactId&gt;jetty-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;${jetty.version}&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;webApp&gt;
                          &lt;contextPath&gt;/&lt;/contextPath&gt;
                          &lt;extraClasspath&gt;configuration/local/&lt;/extraClasspath&gt;
                      &lt;/webApp&gt;
                      &lt;scanTargetPatterns&gt;
                      &lt;scanTargetPattern&gt;
                        &lt;directory&gt;configuration/local/&lt;/directory&gt;
                        &lt;includes&gt;
                          &lt;include&gt;**/*.xml&lt;/include&gt;
                          &lt;include&gt;**/*.properties&lt;/include&gt;
                        &lt;/includes&gt;
                      &lt;/scanTargetPattern&gt;
                    &lt;/scanTargetPatterns&gt;
                  &lt;/configuration&gt;
                  &lt;dependencies&gt;
                      &lt;dependency&gt;
                      ...
                  &lt;/dependencies&gt;
              &lt;/plugin&gt;
              ...
          &lt;plugins&gt;
  </code></pre>
  
  <p>And I am facing to this error
  2012-07-04 10:33:26.460:WARN::Failed startup of context JettyWebAppContext@29b829b8@29b829b8/,file:/C:/DEV/RTCworkspace/myapp/myapp-webapp/src/main/webapp/,file:/C:/DEV/RTCworkspace/myapp/myapp-webapp/src/main/webapp/
  org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: class path resource [databaseLocal.properties] cannot be opened because it does not exist</p>
  
  <p>I found a lot of information but nothing works:
  - <a href="http://wiki.eclipse.org/Jetty/Feature/Jetty_Maven_Plugin" rel="nofollow noreferrer">http://wiki.eclipse.org/Jetty/Feature/Jetty_Maven_Plugin</a>
  - <a href="https://stackoverflow.com/questions/9896694/cant-find-config-files-in-jetty-spring-tiles-deployement">Cant find config files in Jetty + Spring + Tiles deployement</a>
  - <a href="https://stackoverflow.com/questions/6427600/maven-jetty-plugin-not-using-correct-paths">maven-jetty plugin not using correct paths</a></p>
  
  <p>I try also:
  ${basedir}/${externalConfiguration.directory}</p>
  
  <p>Here is an extract of startup log (my webapp name is cct, i replace it until now):</p>
  
  <pre><code>[INFO] webAppSourceDirectory C:\DEV\RTCworkspace\cct\cct-webapp\src\main\webapp does not exist. Defaulting to C:\DEV\RTCworkspace\cct\cct-webapp\src\main\webapp
  [INFO] Reload Mechanic: automatic
  [INFO] Classes = C:\DEV\RTCworkspace\cct\cct-webapp\src\main\webapp\WEB-INF\classes
  [INFO] Adding extra scan target from pattern: C:\DEV\RTCworkspace\cct\cct-webapp\configuration\local\database.properties
  [INFO] Adding extra scan target from pattern: C:\DEV\RTCworkspace\cct\cct-webapp\configuration\local\databaseLocal.properties
  [INFO] Adding extra scan target from pattern: C:\DEV\RTCworkspace\cct\cct-webapp\configuration\local\efrit-security.properties
  [INFO] Adding extra scan target from pattern: C:\DEV\RTCworkspace\cct\cct-webapp\configuration\local\efrit.properties
  [INFO] Adding extra scan target from pattern: C:\DEV\RTCworkspace\cct\cct-webapp\configuration\local\efrit_logback.xml
  [INFO] Adding extra scan target from pattern: C:\DEV\RTCworkspace\cct\cct-webapp\configuration\local\ldap.properties
  [INFO] Adding extra scan target from pattern: C:\DEV\RTCworkspace\cct\cct-webapp\configuration\local\logback.properties
  [INFO] Adding extra scan target from pattern: C:\DEV\RTCworkspace\cct\cct-webapp\configuration\local\logback.xml
  [INFO] Context path = /
  [INFO] Tmp directory = C:\DEV\RTCworkspace\cct\cct-webapp\target\tmp
  [INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
  [INFO] Web overrides =  none
  [INFO] web.xml file = file:/C:/DEV/RTCworkspace/cct/cct-webapp/src/main/webapp/WEB-INF/web.xml
  [INFO] Webapp directory = C:\DEV\RTCworkspace\cct\cct-webapp\src\main\webapp
  [INFO] Starting jetty 7.1.6.v20100715 ...2012-07-04 11:16:56.349:INFO::jetty-7.1.6.v20100715
  </code></pre>
  
  <p>So he says, he see my config file but he is unable to read it.</p>