Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的 Java 项目中有几个分布在不同包中的类,它们包含一个或多个属性,即对应的 getter 和 setter。我需要更改属性的名称以包含前缀。例如,如果我有一个变量
private String one;
我想改为
private String m_one;
我还需要相应的 getter 和 setter 来改变。这里的限制是必须用 ant-scripts 来改变它。
非常感谢任何帮助。
您可以在下面的 ant 代码的帮助下替换 java 文件中的 java 变量
<replaceregexp match="one" replace="m_one" flags="g" byline="true"> <fileset dir="${src.dir}" includes="**/*.java"/> </replaceregexp>