2

For my spring boot microservice, how could I have different versions of Jboss-web.xml configured for development and production. I need this because the security-domain and valve tags apply for production but not development. Hence, I need to either disable these two tags for development or have separate jboss-web.xml for dev and prod environment and have the right file picked up based on the profile or environment. Please advise.

clr meno
  • 53
  • 5
  • I think you can do it with maven and maven profiles. Just pick the files you need to the war while building the app for your profiles. – Patrick Aug 01 '17 at 15:22
  • Thanks for your response. I tried using maven profile( using maven-war-plugin I could configure for webXML to pick the right web.xml for each env), for web.xml but could you advise how to do it for jboss-web.xml? – clr meno Aug 01 '17 at 15:30

1 Answers1

1

You can organize your resources (src/main/resources) by environment:

Resources by environmet

In the build tag from pom.xml enable filtering by environment:

<resource>
    <directory>src/main/resources/${environment}/app-context</directory>
        <filtering>false</filtering>
        <includes>
            <include>*</include>
        </includes>
    <targetPath>${project.build.directory}/${warName}/WEB-INF</targetPath>
</resource>

And execute by command line with this:

mvn clean install -Denvironment="development"

More details in maven reference: https://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html

JuanMoreno
  • 2,498
  • 1
  • 25
  • 34