Read a file into a Maven property

后端 未结 1 710
一向
一向 2020-12-06 18:16

Is it possible to read a file and store the entire contents into a Maven property?

I\'m trying to generate some custom JavaDocs, and they have an option to set a hea

1条回答
  •  不思量自难忘°
    2020-12-06 18:56

    See this question on SO. And here is the properties-maven-plugin.

    If you'd like not to use .properties file, than I can suggest to use the Groovy plugin and a small script that I've written:

    
      org.codehaus.gmaven
      gmaven-plugin
      1.4
      
        
          generate-resources
          
            execute
          
          
            
              header.html
            
            
              def file = new File(project.properties.header_file)
              project.properties.header_content = file.getText()
            
          
        
      
    
    

    After execution of this plugin, you should be able to refer to ${header_content} property that contains header.html file contents.

    0 讨论(0)
提交回复
热议问题