0

I trying to read the environment variable into maven pom file and based on that need to include the specific web.xml file in my war package. So I did following configuration.

          <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.4</version>
                <configuration>

                    <includeEmptyDirectories>true</includeEmptyDirectories>
                    <warSourceExcludes>**/web_*.xml,**/spring/securityContext_*.xml</warSourceExcludes>
                    <webResources>
                        <resource>
                            <directory>src/main/webapp/WEB-INF</directory>
                            <targetPath>WEB-INF</targetPath>
                            <filtering>true</filtering>
                            <includes>
                                <include>**/securityContext_${env.TESTENV}.xml</include>
                            </includes>
                        </resource>
                    </webResources>
                    <webXml>${dir.web}/web_${env.TESTENV}.xml</webXml>
                </configuration>
            </plugin>

But env.TESTENV test is not picking up. Am getting following error.

The specified web.xml file 'xxxxxxx\xxx\xxxx\src\main\webapp\WEB-INF\web_${env.TESTENV}.xml' does not exist -> [Help 1]

For just test I replaced the "TESTENV" with "PATH" it is prining the path appended with the web.xml.

So my question is how make it works?

Earlier I was giving the variable in path with -Dxxx but due to some reasons I should pick that variable from system properties only.

FYI: I am using windows and I defined the TESTENV in system properties and also in user properties.

mallikarjun
  • 1,862
  • 5
  • 23
  • 47

0 Answers0