ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 45739] Problems with BaseDir when the ant is started as Java library from Java Application
Date Fri, 05 Sep 2008 06:39:33 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=45739





--- Comment #3 from Miroslav Nachev <miro@space-comm.com>  2008-09-04 23:39:33 PST ---
(In reply to comment #2)
> My guess is that something in your code invokes project.getBasedir() before the
> project's build file has been parsed.  The most common reason for this is a
> BuildListener invoking getBaseDir in the buildStarted event which is fired
> before the build file gets parsed.
> 

If you see my code where I am resolving the problem you will see that I call
project.getBaseDir(). In principle this is not good kind of programming but I
haven't time to re-write the whole Apache ant code.

Unfortunately the second problem with System Properties is still existing. This
can be solved very easy with one helper class SystemUtil which to be instanced
for each ant instance. All calls to/from the System Properties in the existing
ant code to be replaced with that class like systemUtil.getUserDir():
   public class SystemUtil
   {
      private String userDir;

      public String getUserDir()
      {
         if(userDir == null)
         {
            userDir = System.getProperty("user.dir");
         }

         return userDir;
      }

      public void setUserDir(String userDir)
      {
         this.userDir = userDir;
      }
   }
With that code the problem with multi-tasking and multi-threads will be solved.


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

Mime
View raw message