简体   繁体   中英

Netbeans Javadoc Git Integration

I am using the Netbeans Git plugin for version control and I would like to configure Git to work with the Javadoc comments in my code. Specifically, I would really like for Git to automatically insert a canonical version number and modification date for the @version tag of each class when the class is checked out.

According to the Oracle Javadoc Specifications :

The Java Software convention for the argument to the @version tag is the SCCS string "%I%, %G%", which converts to something like " 1.39, 02/28/97" (mm/dd/yy) when the file is checked out of SCCS.

I would like to do something similar using Git if possible. From what I've read this may be difficult to accomplish with Git and so I've been seriously considering switching to SVN or another VCS that can support this functionality, but I like Git and I would prefer not to switch.

The reason I want this functionality is because I would much rather have Git manage my @version Javadoc tags in a consistent, reliable way instead of manually managing the version number for each class directly, which is prone to errors and inconsistencies.

If there is no easy way to add a tag like %I% and/or %G% to my Javadoc @version tag, then I was hoping there might be another way to accomplish the same type of functionality using the Ant Build Script for my project. The idea being that the Ant Build Script could retrieve the current file version from Git and insert it into the @author tag when the project is built. This wouldn't be the ideal solution but it would be better than nothing.

This isn't really an ideal answer but since I couldn't find any way to add keyword expansion functionality to Git I ended up switching to Subversion. Based on my research, there is no easy way to make keyword expansion work in Git because of the way files are hashed. So if you're like me and keyword expansion is something you'd really like to have then my suggestion would be to consider looking into using one of the more centralized version control systems.

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