需要帮助编写自定义BuildListener

时间:2022-03-05 07:42:18

I would like to add a BuildListener to my headless build process, which is building an Eclipse product. The docs on how to do this are, shall we say, a bit scanty. I think I need to put my custom jar in a plugin and then use the org.eclipse.ant.core.extraClasspathEntries extension point to make that jar visible to Ant. But everything I have tried results in

我想在我的无头构建过程中添加一个BuildListener,它正在构建一个Eclipse产品。我们说,关于如何做到这一点的文件有点不足。我想我需要将自定义jar放在插件中,然后使用org.eclipse.ant.core.extraClasspathEntries扩展点使该jar对Ant可见。但我所尝试的一切都会产生

 [myClass] which was specified to be a build listener is not an instance of org.apache.tools.ant.BuildListener.

My class implements the BuildListener interface. Various postings seem to indicate that this means my class is visible-to/loaded-by the Plugin classloader rather than the Ant classloader. But I thought the whole point of the extension point was to make jars visible to Ant...

我的类实现了BuildListener接口。各种帖子似乎表明这意味着我的类是由插件类加载器而不是Ant类加载器可见/加载的。但我认为扩展点的重点是让Ant可以看到罐子......

Can anyone shed light on what I'm doing wrong? Additional info: I am trying to run this build from the Eclipse IDE at the moment using the AntRunner application.

谁能说清楚我做错了什么?附加信息:我正在尝试使用AntRunner应用程序从Eclipse IDE运行此构建。

2 个解决方案

#1


1  

I had this problem when I had two plugins providing an ant.jar.

当我有两个提供ant.jar的插件时,我遇到了这个问题。

Make sure you use the org.apache.ant plugin and that there is no other plugin providing another ant.jar.

确保使用org.apache.ant插件,并且没有其他插件提供另一个ant.jar。

Another thing I just stumbled upon: The jar containing your contribution must not be in the plugins classpath (Runtime -> Classpath).

我偶然发现的另一件事:包含你的贡献的jar不能在插件类路径中(Runtime - > Classpath)。

See Eclipse Bug 34466.

请参阅Eclipse Bug 34466。

#2


0  

Follow the instructions as for working with contributed tasks and types found here: Developing Ant tasks and Contributed Ant tasks

按照说明操作此处的贡献任务和类型:开发Ant任务和Contributed Ant任务

#1


1  

I had this problem when I had two plugins providing an ant.jar.

当我有两个提供ant.jar的插件时,我遇到了这个问题。

Make sure you use the org.apache.ant plugin and that there is no other plugin providing another ant.jar.

确保使用org.apache.ant插件,并且没有其他插件提供另一个ant.jar。

Another thing I just stumbled upon: The jar containing your contribution must not be in the plugins classpath (Runtime -> Classpath).

我偶然发现的另一件事:包含你的贡献的jar不能在插件类路径中(Runtime - > Classpath)。

See Eclipse Bug 34466.

请参阅Eclipse Bug 34466。

#2


0  

Follow the instructions as for working with contributed tasks and types found here: Developing Ant tasks and Contributed Ant tasks

按照说明操作此处的贡献任务和类型:开发Ant任务和Contributed Ant任务