You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/04/08 13:36:10 UTC

[GitHub] [flink] zentol commented on issue #11592: [FLINK-16871][runtime] Make more build time information available at runtime

zentol commented on issue #11592: [FLINK-16871][runtime] Make more build time information available at runtime
URL: https://github.com/apache/flink/pull/11592#issuecomment-610963947
 
 
   >You cannot simply switch branch and then successfully run the project without doing a mvn clean generate-sources.
   
   This isn't quite accurate. By virtue of us rarely adding code generation and generally not changing it, it _over time_ becomes feasible to switch between the currently supported version branches.
   Naturally this goes out the window the moment we add a new code generation, hence this discussion.
   
   > Putting a question back: What implementation approach do you recommend?
   
   So, I only briefly looked into it.
   
   My original idea was to have a normal `Version.java` in the source, to be modified during the build only, but you'd have to jump through quite a few hoops to make this work. (Exclude the vanilla version from the source, add the modified file into a custom directory so IntelliJ doesn't complain, add this directory to the list of source directories). So this isn't really feasible, which is unfortunate, and a bit surprising since the use-case is fairly simple.
   
   One approach we could take though is similar to the old one we had.
   Since we're just interested in exposing maven properties we should be able to add a text file into `src/main/resources` containing lines like `PROJECT_VERSION: ${project.version}` and configure maven to use filtering for this resource.
   ```
   <project>
     <build>
       <resources>
           <resource>
               <directory>src/main/resources</directory>
               <filtering>true</filtering>
           </resource>
       </resources>
     </build>
   </project>
   ```
   
   Then just parse it back. This could even be a JSON file that we throw jackson at.
   
   However, I do realize that I may be too strict in regards to code-generation, so I would encourage you to raise the issue on the mailing list in search for supporters.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services