0
我有编辑所有子目录中的Java文件的内容相对简单的Ant脚本commentOutXmlAnnotations.xml
注释掉通过正则表达式的某些行:Ant脚本修改.java文件中的“常规” Eclipse项目的工作,但不是在Maven的Eclipse项目
<?xml version="1.0"?>
<project
name="CommentOutXmlAnnotations"
basedir="."
default="commentOutXmlAnnotations" >
<!-- This Ant script comments out the following lines from the Java files in this directory
and all subdirectories:
-import javax.xml.bind.annotation.*;
[email protected]*
To run this in Eclipse, right-click on this file and click "Run As->Ant Build".
-->
<target
name="commentOutXmlAnnotations"
description="Run" >
<replaceregexp
byline="false"
flags="g" >
<regexp pattern="(@Xml[A-Za-z0-9]+(\([^)]+\))?|import javax\.xml\.bind\.annotation\.[A-Za-z0-9.]+;)[ \t]*(\r?\n)" />
<substitution expression="/*\1*/\3" />
<fileset dir="." >
<include name="*/*.java" />
</fileset>
</replaceregexp>
</target>
</project>
如果我把commentOutXmlAnnotations.xml
到一个新的通用的Eclipse项目与子目录,然后右键单击并做“运行AS-> Ant构建” .java文件,一切工作正常,并在.java文件的行被注释掉了。
但是,如果我放弃这一commentOutXmlAnnotations.xml
文件到Eclipse的Maven项目,并尝试做同样的事情,它似乎执行,我会得到的控制台输出:
Buildfile: D:\Eclipse_Juno_SR1_OTP\opentripplanner-pojos-unversioned\commentOutXmlAnnotations.xml
commentOutXmlAnnotations:
BUILD SUCCESSFUL
Total time: 302 milliseconds
不过的内容子目录下的.java文件不会改变。我认为这是与Maven项目目录设置。
如何配置项目/ ant脚本在它被放置在同一目录下执行,在Eclipse Maven项目?