Closed melloware closed 3 years ago
Hi @melloware,
The only way I'm aware of is through maven. Also, it appears you missing a bracket - {. Not sure if it's a typo or not.
Add the following plugin to you pom:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource>
<filtering>true</filtering>
<directory>src/main/webapp</directory>
<includes>
<include>**/web.xml</include>
</includes>
</resource>
</webResources>
<warSourceDirectory>src/main/webapp</warSourceDirectory>
<webXml>src/main/webapp/WEB-INF/web.xml</webXml>
</configuration>
</plugin>
and property:
`
Cc @ericglau
@volosied I agree but that does not work with Liberty you get this error...
[INFO] [WARNING ] Wrong value in context init parameter 'javax.faces.PROJECT_STAGE' (='${liberty.var.jsf.stage}'), using default value 'Production'
@yeekangc @ericglau My project is here: https://github.com/melloware/liberty-faces
When properly running in JSF Development mode you will see this in console...
[INFO] [AUDIT ] CWWKT0016I: Web application available (default_host): http://laptop-tjeaghk8:8080/showcase/
[INFO] [WARNING ]
[INFO]
[INFO] *******************************************************************
[INFO] *** WARNING: Apache MyFaces-2 is running in DEVELOPMENT mode. ***
[INFO] *** ^^^^^^^^^^^ ***
[INFO] *** Do NOT deploy to your live server(s) without changing this. ***
[INFO] *** See Application#getProjectStage() for more information. ***
[INFO] *******************************************************************
[INFO]
[INFO] [AUDIT ] CWWKZ0001I: Application liberty-faces started in 11.122 seconds.
Thank you for sharing the code. I see what you mean now. Liberty's loose config is looking at the the web.xml in the src/main/webapp/WEB-INF/web.xml directly, and no variable substitution occurs in-between.
I agree this would be a great enchantment for the liberty-maven-plugin. I'm not as familiar with the plugin, but other team members are looking into this further. Thanks!
Moving the discussion into the liberty-maven-plugin repo issue: https://github.com/OpenLiberty/ci.maven/issues/1104 Thanks for bringing it up.
Going to close this issue now.
Is your feature request related to a problem? Please describe. In most EE containers I do something like this in the web.xml
So I can dynamically set based on Maven for
Development
orProduction
. This does not work in OpenLiberty as it seems to use the in place web.xml and does not allow substitution.Describe the solution you'd like Similar to how its done in Quarkus when running in Dev
liberty:dev
mode set stage toDevelopment
When running from JAR or deployment set toProduction
mode.