You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2008/06/28 13:51:07 UTC

DO NOT REPLY [Bug 45303] New: Ant works in a console, but no when called from java

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: notifications@ant.apache.org
        ReportedBy: rom1v@yahoo.fr


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.

DO NOT REPLY [Bug 45303] Ant works in a console, but no when called from java

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45303


Peter Reilly <pe...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




--- Comment #2 from Peter Reilly <pe...@apache.org>  2008-08-21 14:35:39 PST ---
Please do not enter bugs like this.
ant from the command line is done by java, therefore there
must be something missing from your code in configuring the
objects, please refer to mailing list for help.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 45303] Ant works in a console, but no when called from java

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45303





--- Comment #1 from rom <ro...@yahoo.fr>  2008-06-28 04:51:47 PST ---
Created an attachment (id=22195)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=22195)
the build.xml


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.