https://issues.apache.org/bugzilla/show_bug.cgi?id=45303
Summary: Ant works in a console, but no when called from java
Product: Ant
Version: 1.7.0
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Core
AssignedTo: [email protected]
ReportedBy: [EMAIL PROTECTED]
I attached a build.xml, which is in /home/rom/java/emodelfilter/build.xml.
When I launch it from a console, it works :
$ ant -f /home/rom/java/emodelfilter/build.xml deploy
Buildfile: /home/rom/java/emodelfilter/build.xml
clean:
[delete] Deleting directory /home/rom/java/emodelfilter/bin
[delete] Deleting directory /home/rom/java/emodelfilter/dist
compile:
[mkdir] Created dir: /home/rom/java/emodelfilter/bin
[javac] Compiling 16 source files to /home/rom/java/emodelfilter/bin
jar:
[mkdir] Created dir: /home/rom/java/emodelfilter/dist
[jar] Building jar: /home/rom/java/emodelfilter/dist/emodelfilter.jar
deploy:
[copy] Copying 1 file to /home/rom/java/emodelfilter/dist/lib
[copy] Copying 1 file to /home/rom/java/emodelfilter/dist
BUILD SUCCESSFUL
Total time: 1 second
But when I try to call it from Java :
Project ant = new Project();
ProjectHelper helper = new ProjectHelperImpl();
DefaultLogger log = new DefaultLogger();
log.setErrorPrintStream(System.err);
log.setOutputPrintStream(System.out);
log.setMessageOutputLevel(Project.MSG_INFO);
ant.addBuildListener(log);
File buildFile = new File("/home/rom/java/emodelfilter/build.xml");
ant.init();
helper.parse(ant, buildFile);
ant.executeTarget("deploy");
I have this error:
clean:
[delete] Deleting directory /home/rom/java/emodelfilter/bin
compile:
[mkdir] Created dir: /home/rom/java/emodelfilter/bin
[javac] Compiling 16 source files to /home/rom/java/emodelfilter/bin
Exception in thread "main" /home/rom/java/emodelfilter/build.xml:26: No
directory specified for fileset.
at
org.apache.tools.ant.types.AbstractFileSet.getDirectoryScanner(AbstractFileSet.java:418)
at org.apache.tools.ant.types.FileSet.iterator(FileSet.java:70)
at
org.apache.tools.ant.types.resources.Union.getCollection(Union.java:105)
at
org.apache.tools.ant.types.resources.Union.getCollection(Union.java:88)
at
org.apache.tools.ant.types.resources.BaseResourceCollectionContainer.cacheCollection(BaseResourceCollectionContainer.java:244)
at
org.apache.tools.ant.types.resources.BaseResourceCollectionContainer.iterator(BaseResourceCollectionContainer.java:120)
...
It seems strange that a build.xml which works with ant in a console doesn't
work when called from java.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.