【问题标题】:Headless PDE build successful but no file无头 PDE 构建成功但没有文件
【发布时间】:2012-01-14 09:37:20
【问题描述】:

我为 Eclipse 创建了一个视图插件。我可以从项目中导出 jar,它工作得很好。我正在尝试创建一个 Ant 构建脚本来自动化它。

我已经从 Eclipse 创建了两个 Ant 构建脚本

  1. 右键单击项目、导出、Antbuild 文件。
  2. 通过插件的导出向导,我在选项中选择“另存为ant script”。

第一个很长,它有 init 目标、build 目标等。第二个就是:

<?xml version="1.0" encoding="UTF-8"?>
<project default="plugin_export" name="build">
    <target name="plugin_export">
        <pde.exportPlugins destination="C:\newPlugin" exportSource="false" exportType="directory" plugins="myplugin" useJARFormat="false"/>
    </target>
</project>

我尝试通过命令行运行它们:

java -jar c:\eclipse\plugins\org.eclipse.equinox.launcher_*.jar -application org.eclipse.ant.core.antRunner -data C:\newPlugin -buildfile build_plugin.xml

如果我运行 long antbuild,它会在 bin 目录下创建 obj 文件。这很好,但我想要插件 jar 文件。我想第二个应该这样做。但是,即使构建成功,我也看不到任何 jar 文件。

这是 ant 脚本输出:

Apache Ant(TM) version 1.8.2 compiled on December 20 2010
Buildfile: build_plugin.xml
parsing buildfile C:\newPlugin\build_plugin.xml with URI = file:/C:/newPlugin/build_plugin.xml
Project base dir set to: C:\newPlugin
Build sequence for target(s) `plugin_export' is [plugin_export]
Complete build sequence is [plugin_export, ]

plugin_export:
parsing buildfile jar:file:/C:/eclipse/plugins/org.apache.ant_1.8.2.v20110505-1300/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/C:/eclipse/plugins/org.apache.ant_1.8.2.v20110505-1300/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
BUILD SUCCESSFUL

BUILD SUCCESSFUL
Total time: 2 seconds

【问题讨论】:

    标签: eclipse plugins ant pde


    【解决方案1】:

    您的运行看起来正确。当我执行相同的步骤时:

    <project default="plugin_export" name="build">
            <target name="plugin_export">
                    <pde.exportPlugins destination="/opt/pwebster/workspaces/deploymentTest" exportSource="false" exportType="directory" plugins="org.eclipse.core.expressions" qualifier="v201112061450" useJARFormat="true"/>
            </target>
    </project>
    

    然后运行它:

    bash$ eclipse/eclipse -noSplash \
    -application org.eclipse.ant.core.antRunner 
    -data /opt/pwebster/workspaces/build38x/ \
    -buildfile build_file.xml
    

    我进入了我的输出目录deploymentTest/plugins/org.eclipse.core.expressions_3.4.300.v201112061450.jar

    请注意:您的目标应该是工作区之外的目录,并且您应该使用 -data 将工作区传递给调用

    【讨论】:

    • 这很奇怪而且很有前途。即使我创建了一个虚拟项目并运行命令行,我仍然没有得到任何东西。我错过了日食吗?我使用 Eclipse SDK 4.1.0。我将重新安装并重试。如果您有任何其他想法,我将很高兴听到。
    • Paul,这可能是 Eclipse 在您尝试获取 build.xml 时创建的插件吗?我刚刚在我的家用机器上尝试了相同的虚拟项目(下载了最新的 java 和 eclipse),但没有运气。我仍然无法进行无头构建。这可能是一个错误吗?
    • 您的项目和部署目录是否为您的工作区使用不同的目录?您是否通过 -data 中的项目传入工作区?
    • 天哪,我一直给项目的路径,而不是工作区路径。现在它起作用了。非常感谢!
    • 如果我只是想构建插件,那么必须为工作区提供 -data 是不切实际的。有没有办法在不指定工作区的情况下做到这一点?
    猜你喜欢
    • 2011-04-26
    • 2016-03-06
    • 1970-01-01
    • 2010-11-15
    • 1970-01-01
    • 1970-01-01
    • 2011-08-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多