saiddfhi / gwt-maven

Automatically exported from code.google.com/p/gwt-maven
0 stars 0 forks source link

Properties files in src/main/resources are not filtered and read by GWT properly #193

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Is this Maven 1 or Maven 2?
Maven 2

What steps will reproduce the problem?

1. Create a config.properties file in src/main/resources. Its contents
should be:

services.host=${services.host}

2. Define a property in pom.xml and enable filtering on resources.

   <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

    <properties>
        <services.host>localhost</services.host>
    </properties>

3. Running "mvn resources:resources" filters property and
target/classes/config.properties has the correct values.

What is the expected output? What do you see instead?

I have a servlet that reads this file using the following code:

  @Override
  public void init(ServletConfig servletConfig) {
      Properties config = new Properties();
      ClassLoader loader = this.getClass().getClassLoader();
      InputStream istream =
loader.getResourceAsStream("neo-config.properties");

      try {
          config.load(istream);
      } catch (Exception e) {
          e.printStackTrace();
          System.err.println("Configuration failed to load: " +
e.getMessage());
      }

      System.out.println("Host" + config.getProperty("services.host"));
  }

Rather than printing "localhost", this prints "${services.host}".

What version of the product are you using? On what operating system?

2.0-beta26
OS X 10.5.6

Please provide any additional information below.

http://groups.google.com/group/gwt-maven/browse_thread/thread/51e7d46723a40dfc

Original issue reported on code.google.com by mrai...@gmail.com on 3 Feb 2009 at 8:33

GoogleCodeExporter commented 9 years ago
http://groups.google.com/group/gwt-maven/browse_thread/thread/51e7d46723a40dfc

<resourcesOnPath>false</resourcesOnPath> 

Original comment by charlie....@gmail.com on 4 Feb 2009 at 1:45