How to add a file to a war with Maven

前端 未结 1 1704
死守一世寂寞
死守一世寂寞 2020-12-30 07:24

I have developed a maven plugin that downloads the release notes from JIRA. It\'s bound by default to the \'generate-sources\' phase and creates a \'release.txt\' file in th

相关标签:
1条回答
  • 2020-12-30 07:43

    I think this can be done using this feature of that plugin:

    Adding and Filtering External Web Resources: http://maven.apache.org/plugins/maven-war-plugin/examples/adding-filtering-webresources.html

    Which would allow you to generate your release.txt into a separate folder (not src) and have the plugin treat it as an extra resources folder.

    Hope that helps.

    <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-war-plugin</artifactId> 
      <configuration> 
        <webResources> 
          <resource> 
            <directory>${project.build.directory}</directory> 
            <targetPath>WEB-INF</targetPath> <!-- introduced in plugin v 2.1 -->
            <includes> 
              <include>release.txt</include> 
            </includes> 
          </resource> 
        </webResources> 
      </configuration> 
    </plugin> 
    
    0 讨论(0)
提交回复
热议问题