使用ant刷新Eclipse脚本,无法找到项目

时间:2013-04-24 10:01:57

标签: ant eclipse-plugin

我尝试刷新eclipse作为Powershell-script的最后一步。我位于“... / My_Project”,而.xml文件位于“.../My_Project/base/cmd”。因此最后一行是

C:\app\eclipse_juno_SR2\eclipse -nosplash -application org.eclipse.ant.core.antRunner -f .\base\cmd\refresh.xml -consolelog

我使用的脚本是

<?xml version="1.0" encoding="UTF-8"?>
<project name="refresh_project" default="refresh" basedir="./../..">
<target name="refresh">
    <eclipse.refreshLocal resource="/My_Project" depth="infinite"/>
</target>
</project>

当我在eclipse中使用它时,构建工作正常但是当使用脚本时它只显示以下消息:

org.eclipse.m2e.logback.configuration: The org.eclipse.m2e.logback.configuration
 bundle was activated before the state location was initialized.  Will retry aft
er the state location is initialized.
org.eclipse.m2e.logback.configuration: Logback config file: C:\Users\Dennis.Hert
el\workspace\.metadata\.plugins\org.eclipse.m2e.logback.configuration\logback.1.
3.0.20130129-0926.xml
org.eclipse.m2e.logback.configuration: Initializing logback
org.eclipse.m2e.logback.configuration: eclipse.consoleLog=true
Buildfile: .\base\cmd\refresh.xml

refresh:
[eclipse.refreshLocal] Warning: project /My_Project does not exist and cannot be
refreshed.
BUILD SUCCESSFUL

我试过

  1. 多个项目
  2. eclipse.convertPath fileSystemPath="/My_Project"
  3. property="Test" fileSystemPath="/${workspace_loc}/My_Project"
  4. fileSystemPath="/${workspace_loc:My_Project}"
  5. fileSystemPath="/path/to/my/project/My_Project"
  6. 使用其他环境变量并使用${Test}作为资源
  7. 但它要么不扩展变量(工作区),要么抛出错误,因为路径无效(它不是)或没有任何变化

    请原谅我这是一个愚蠢的问题,我正在研究它好几个小时,我以前从未使用过蚂蚁,希望我不像我想的那样愚蠢

1 个答案:

答案 0 :(得分:1)

我的猜测是,运行ant脚本的Eclipse实例所在的工作空间与项目所在的工作空间不同。要解决此问题,请确保在ant脚本启动时指定Eclipse工作空间位置。您可以使用osgi.instance.area系统属性从启动脚本的命令

设置工作空间位置
-Dosgi.instance.area=/path/to/my/workspace

Here is a complete description of the command line option.