3

I have a WAR file which contains the version number to it. In openliberty server.xml I had to specify the application location where the version number could be replaced by wildcard matching.
e.g., the file name is: my-company-project-vX.Y.war and the corresponding application definition in server.xml is:

<?xml version="1.0" encoding="UTF-8"?>
<server description="my-company">

    <application context-root="my-company-project" 
        id="my-company-project-war" name="my-company-project-war" 
        type="war" location="my-company-project-vX.Y.war"></application>

</server>

Now if the project version is changed I have to always change the location attribute in application.

Is it possible to use some kind of wildcard so that I do not always have to replace the version?

I had tried * as location="my-company-project-*.war" but that did not worked and I got warning in server logs:

[WARNING ] CWWKZ0014W: The application my-company-project-war could not be started 
as it could not be found at location my-company-project-*.war.

And I was expecting it to pick the my-company-project-vX.Y.war correctly.

Mohammad Faisal
  • 5,783
  • 15
  • 70
  • 117

1 Answers1

3

No it is not possible to use wildcards in the location field. If wildcards were supported it could match multiple files and we wouldn't be able to determine which file to use.

What I do is make sure the version number is not in the war file name. Assuming you are using maven configuring a final name in the pom.xml is the simplest way to do this. Something like this would work:

  <build>
        <finalName>${project.name}</finalName>
  </build>
Alasdair
  • 3,071
  • 15
  • 20