How to check if an Ant task is available in the current JVM?

All our projects' build.xml files, designed to be run in Eclipse, contain invocations to the special <eclipse.refreshLocal depth="infinite" resource="/" /> defined only in Eclipse. We must configure Ant to use the same JVM as the workspace in order for it to be run, otherwise we get an error. In order to export the same build scripts to platforms such as Bamboo a

如何检查当前JVM中是否有Ant任务?

我们所有的项目build.xml文件都是在Eclipse中运行的,它包含对仅在Eclipse中定义的特殊<eclipse.refreshLocal depth="infinite" resource="/" />调用。 我们必须将Ant配置为使用与工作空间相同的JVM才能运行,否则会出现错误。 为了将相同的构建脚本导出到Bamboo和Travis等平台,我如何修改调用以获得条件? 我的意思是,如果任务没有找到,就忽略它。 如果我在Bamboo中运行我的Ant脚本,我预计

ANT exec task with WINEPREFIX

I need to execute a wine program (on Linux) within an ANT script (build.xml) from eclipse. Supposing the wine program is in default WINEPREFIX, the following would work flawless: <exec dir="${dist}" executable="wine" os="Linux"> <arg line="'C:\Program Files\Inno Setup 5\Compil32.exe'" /> <arg line="/cc 'setup.iss'" /> </exec> Unfortunatelly, due to compatibilit

ANT执行任务与WINEPREFIX

我需要在eclipse中的ANT脚本(build.xml)中执行wine程序(在Linux上)。 假设Wine程序使用默认的WINEPREFIX,以下内容将完美无瑕: <exec dir="${dist}" executable="wine" os="Linux"> <arg line="'C:\Program Files\Inno Setup 5\Compil32.exe'" /> <arg line="/cc 'setup.iss'" /> </exec> 不幸的是,由于与其他葡萄酒程序的兼容性问题,我已经将该程序安装到另一个WINEPREFIX。 我可

How to execute a good refactor of a big ant script that involves many projects?

I am very new in Ant (I came from Maven and, at this time, Ant is my nightmare). I have the following situation: In the Eclipse workspace I have some Java project that interact with each other composing a final single application. One of this project (named CrystalIceGUI ) that implement the application GUI contain in itself the unique build.xml Ant script that, simplifying at most, do the

如何执行一个涉及很多项目的大型ant脚本的重构?

我在Ant中很新(我来自Maven,此时Ant是我的噩梦)。 我有以下情况: 在Eclipse工作区中,我有一些Java项目互相交互组成最终的单个应用程序。 其中一个实现应用程序GUI的项目(名为CrystalIceGUI )本身包含唯一的build.xml Ant脚本,它最多可以简化以下操作: 1) 编译所有项目 (这些项目被视为CrystalIceGUI项目的依赖项) 2)为每个项目创建一个名为Release的目录(在正确的项目中),并将与该项目相关的.jar文件

Java ClassLoader cant find class

in my project there are - among others - two classes: TheProblem and Server. public class TheProblem { public static void main (String args []) throws ClassNotFoundException { ClassLoader.getSystemClassLoader().loadClass("Server"); } } When I execute the code from the command line, everything works just fine. But when I use ANT to execute the code, I get a ClassNotFoundExceptio

Java ClassLoader不能找到类

在我的项目中还有两个类:TheProblem和Server。 public class TheProblem { public static void main (String args []) throws ClassNotFoundException { ClassLoader.getSystemClassLoader().loadClass("Server"); } } 当我从命令行执行代码时,一切正常。 但是当我使用ANT执行代码时,我得到一个ClassNotFoundException - 尽管Server.class和TheProblem.class都在同一个目录中。 我的项目的目录结构非常

Java extend Application Classloader?

Problem: My company has a lot of different jars/existing projects that they run at their customers. For debugging purposes, we would like to generate a log which class every component loads and more specifically: from where . For example: stack.overflow.ClassA in jar StackOverFlowJar.jar. My thoughts: I have experimented with passing each jar/existing project a custom class loader. This cust

Java扩展应用程序类加载器?

问题:我的公司有很多不同的罐子/现有项目,它们在客户中运行。 为了进行调试,我们希望生成一个日志,其中每个组件加载哪个类,更具体地说: 从哪里开始 。 例如:jar StackOverFlowJar.jar中的stack.overflow.ClassA。 我的想法:我已经尝试将每个jar /现有项目传递给一个自定义类加载器。 这个自定义类加载器可能会将上面的信息写入文件,并将正常的类加载流委派给其父代。 我的CustomClassLoader扩展了ClassLoader,

java.lang.NoClassDefFoundError, Ant task could not see classes in jar inside jar

I wrote Java tool (in this case is iOffloadMaker) which also contains own-defined Ant Task as the main launcher to launch the tool with Ant. I bundled all external jar libraries into delivered my tool's jar. I also provide a simple Ant build.xml file to launch my tool: <?xml version="1.0"?> <project name="TestBound" default="main" basedir="."> <!-- Sets varables which ca

java.lang.NoClassDefFoundError,Ant任务无法在jar中的jar中看到类

我编写了Java工具(在这种情况下是iOffloadMaker),它也包含自定义的Ant Task作为启动Ant的主要启动工具。 我将所有外部jar库捆绑到我的工具jar中。 我还提供了一个简单的Ant build.xml文件来启动我的工具: <?xml version="1.0"?> <project name="TestBound" default="main" basedir="."> <!-- Sets varables which can later be used. --> <property name="src.dir" value="src" /> &l

Modifying behaviour of default classloader in Java

I am attempting to load a single class using custom logic (ie I want to swap out the implementation of a class in my libraries with a custom version). I'd like to create my own, custom classloader, which proxies to the default classloader. However, It appears that my default classloader: sun.misc.Launcher.AppClassLoader , is not visible - meaning that I cannot extend it. Any solutions fo

在Java中修改默认类加载器的行为

我正在尝试使用自定义逻辑加载单个类(即,我想用自定义版本替换我的库中的类的实现)。 我想创建自己的自定义类加载器,它代理默认的类加载器。 但是,看起来我的默认类加载器: sun.misc.Launcher.AppClassLoader不可见 - 这意味着我无法扩展它。 我们非常感谢任何用于创建单个类加载器的解决方案,该类加载器足够强大,可以复制现有类加载器的行为,同时在一个特定类中进行子类化。 请注意,我试过使用 Thread current

creating an executable jar file with ant which includes the build.xml file

I am trying to use ant to build an application, run the application's main() method, run junit tests, and package everything in a jar file (source+build+libraries+build.xml). The classes include a runner class with a main() method entry point. The objective however is to inlcude all libraries used, like junit.jar, and the ant build.xml itself. I was wondering if there is a way for the ex

使用包含build.xml文件的ant创建一个可执行的jar文件

我试图用ant来构建应用程序,运行应用程序的main()方法,运行junit测试,并将所有内容都打包到jar文件中(source + build + libraries + build.xml)。 这些类包含一个带有main()方法入口点的runner类。 然而,目标是包含所有使用的库,如junit.jar和ant build.xml本身。 我想知道是否有一种可执行jar文件的方式来运行ant构建文件itslef的选定目标,而不仅仅是main()方法。 显然,我不需要再次运行编译目标,而只需

Create a eclipse project using existing ant build.xml file

I am trying to create a project in eclipse from an existing ant build.xml file. I receive a list of javac tasks found and directed to select a single javac task to continue. How do I process the javac tasks? I wouldnt recommend going the Ant route at this stage as it complicates things. Maven would be the way to go in the end, or Gradle - but that's way out of the scope at this point. E

使用现有的ant build.xml文件创建一个eclipse项目

我正尝试从现有的ant build.xml文件在eclipse中创建一个项目。 我收到一个javac任务清单,找到并指示选择一个javac任务继续。 我如何处理javac任务? 我不推荐在这个阶段去蚂蚁路线,因为它使事情变得复杂。 Maven最终会走的路,或者说Gradle--但这在目前已经超出了范围。 Eclipse不需要ant或build.xml ant相关的文件! 在Eclipse中执行以下操作 如果您使用普通Java,则创建一个新的Java项目,如果您计划使用J2EE,则

Ant build fails due to unfound imports in other projects

I have a java project which imports and uses classes in other projects. I am able to successfully build this project in eclipse. From eclipse I then exported an Ant Buildfile, build.xml. If I attempt to run this file with eclipse or via cmd prompt it fails. One of the many import reported error is: [javac] H:...sortedprovidablemanagertestSimpleObject.java:8: error: package com.rock.common.

由于在其他项目中导入不正确,Ant构建失败

我有一个java项目,在其他项目中导入和使用类。 我能够在eclipse中成功构建这个项目。 然后从Eclipse中导出一个Ant构建文件build.xml。 如果我尝试使用eclipse或通过cmd提示运行此文件,它将失败。 许多导入报告错误之一是: [javac] H:... sortedprovidablemanagertest SimpleObject.java:8:error:package com.rock.common.core.providable.abstractions does not exist [javac] import com.rock.common.core.pr