简体   繁体   中英

How to bundle the war with different configuration in maven

  1. i need to change multiple xml file while build a war using maven like below example
  2. I am able to do the required change in the target folder. But It is not copied in to the war file

     <plugin> <groupId>com.google.code.maven-replacer-plugin</groupId> <artifactId>replacer</artifactId> <version>1.5.3</version> <executions> <execution> <phase>prepare-package</phase> <goals> <goal>replace</goal> </goals> <id>dse xml replacer</id> <configuration> <file> ${project.artifactId}/target/${project.artifactId}-${version}/WEB-INF/example.xml </file> <replacements> <replacement> <token>reloadingEnabled=".*"</token> <value>reloadingEnabled="false"</value> </replacement> </replacements> </configuration> </execution> </plugin> 

Try the maven-war-plugin , like:

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.6</version>
    <configuration>
      <webResources>
        <resource>
          <!-- this is relative to the pom.xml directory -->
          <directory>resource2</directory>
          <includes>
            <include>**/*.xml</include>
          </includes>
        </resource>
      </webResources>
    </configuration>
  </plugin>

More info https://maven.apache.org/plugins/maven-war-plugin/examples/adding-filtering-webresources.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM