You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2006/06/12 00:09:28 UTC

DO NOT REPLY [Bug 39780] New: - antunit doesnt set java.class.path

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39780>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39780

           Summary: antunit doesnt set java.class.path
           Product: Ant
           Version: unspecified
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: AntUnit
        AssignedTo: dev@ant.apache.org
        ReportedBy: stevel@apache.org


this test works on the command line:

  <target name="testPath" depends="define">
    <book:filesize property="size">
      <path path="${java.class.path}"/>
    </book:filesize> 
    <echo> classpath size=${size}</echo>
  </target>

but when run from antunit, it fails cos java.class.path isnt set.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


DO NOT REPLY [Bug 39780] - antunit doesnt set java.class.path

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39780>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39780


peterreilly@apache.org changed:

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




------- Additional Comments From peterreilly@apache.org  2006-10-06 08:42 -------
This was fixed when matt modified antunit.java
"set all properties by calling initProperties().  System props were missing."

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: DO NOT REPLY [Bug 39780] New: - antunit doesnt set java.class.path

Posted by Steve Loughran <st...@apache.org>.
Matt Benson wrote:
> I see re <book:filesize>; it is an example of
> extension more than of usage.  This clears up my
> question.  :)  Nice to be able to look at the examples
> ahead of time... 
> 

yeah, you can infer my progress through looking at the source and/or 
bugreps. It builds on gump too

http://vmgump.apache.org/gump/public/antbook/index.html

or at least, did when ant-contrib was there. I need to patch gump to get 
ant-contrib back from where sourceforge moved it.

As to why the examples are in sourceforge, well, if you are covering OSS 
tools and processes, why keep the source in the old laptop in the corner 
of the room that serves as the home music/ssh/cvs server(*)?

-Steve

(*) as opposed to the slightly less old laptop in the other room that 
serves as the HP Laboratories public SOAP endpoint of the global grid 
foundation CDDLM deployment API standard. It's a lot easier bringing up 
a machine at home than at work, at least once you explain to the IT 
support crew that its role is to permit untrusted callers to deploy 
applications on it. Having the server 6 miles, a proxy server and two 
firewalls away from my desktop makes testing web service APIs more 
realistic too.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: DO NOT REPLY [Bug 39780] New: - antunit doesnt set java.class.path

Posted by Matt Benson <gu...@yahoo.com>.
I see re <book:filesize>; it is an example of
extension more than of usage.  This clears up my
question.  :)  Nice to be able to look at the examples
ahead of time... 

-Matt

--- Steve Loughran <st...@apache.org> wrote:

> Matt Benson wrote:
> >> this test works on the command line:
> >>
> >>   <target name="testPath" depends="define">
> >>     <book:filesize property="size">
> >>       <path path="${java.class.path}"/>
> >>     </book:filesize> 
> >>     <echo> classpath size=${size}</echo>
> >>   </target>
> >>
> >> but when run from antunit, it fails cos
> >> java.class.path isnt set.
> > 
> > Steve, I was noticing this filesize task you've
> got in
> > the "book" ns... I assume this relates to an
> example
> > that will go in the forthcoming revision to the
> > Manning book.  How does <book:filesize> differ
> from
> > the 1.6.3+ <length> task?
> 
> hey, go check out antbook.cvs.sourceforge.net and
> see for yourself.
> 
> 
> For reference, it only does file resources. I
> iterate and cast
> 
>      public void execute() throws BuildException {
>          if (property == null) {
>              throw new BuildException("No
> property");
>          }
>          long size = 0;
>          int count = 0;
>          Iterator element = resources.iterator();
>          while (element.hasNext()) {
>              Resource resource = (Resource)
> element.next();
>              if (!(resource instanceof
> FileResource)) {
>                  throw new BuildException("Not a
> file: " + resource);
>              }
>              log(resource.getName(),
> Project.MSG_VERBOSE);
>              FileResource fileResource =
> (FileResource) resource;
>              File file = fileResource.getFile();
>              if (!file.exists()) {
>                  throw new BuildException("Not
> found: " + file);
>              }
>              size += file.length();
>              count++;
>          }
>          if (count == 0) {
>              log("No files sized up",
> Project.MSG_WARN);
>          }
>          getProject().setNewProperty(property,
> Long.toString(size));
>      }
> 
> It just shows how to go from a file to a fileset to
> resources.
> 
> the other interesting task does classpath setup and
> delegates to java
> 
>      /**
>       * {@inheritDoc}
>       * @throws org.apache.tools.ant.BuildException
>       *          if something goes wrong with the
> build.
>       */
>      public void execute() {
>          Java java=new Java();
>          java.bindToOwner(this);
>          java.init();
>          java.setClasspath(classpath);
>          java.setClassname(classname);
>          java.setFailonerror(true);
>          java.setFork(true);
>          Iterator element = resources.iterator();
>          while (element.hasNext()) {
>              Resource resource = (Resource)
> element.next();
>             
> java.createArg().setValue(resource.toString());
>          }
>          java.execute();
>      }
> 
> Its a resource-enabled equivalent of <apply>,
> effectively. And you can 
> see why I like toString() to be meaningful.
> 
> -steve
> 
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> dev-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> dev-help@ant.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: DO NOT REPLY [Bug 39780] New: - antunit doesnt set java.class.path

Posted by Steve Loughran <st...@apache.org>.
Matt Benson wrote:
>> this test works on the command line:
>>
>>   <target name="testPath" depends="define">
>>     <book:filesize property="size">
>>       <path path="${java.class.path}"/>
>>     </book:filesize> 
>>     <echo> classpath size=${size}</echo>
>>   </target>
>>
>> but when run from antunit, it fails cos
>> java.class.path isnt set.
> 
> Steve, I was noticing this filesize task you've got in
> the "book" ns... I assume this relates to an example
> that will go in the forthcoming revision to the
> Manning book.  How does <book:filesize> differ from
> the 1.6.3+ <length> task?

hey, go check out antbook.cvs.sourceforge.net and see for yourself.


For reference, it only does file resources. I iterate and cast

     public void execute() throws BuildException {
         if (property == null) {
             throw new BuildException("No property");
         }
         long size = 0;
         int count = 0;
         Iterator element = resources.iterator();
         while (element.hasNext()) {
             Resource resource = (Resource) element.next();
             if (!(resource instanceof FileResource)) {
                 throw new BuildException("Not a file: " + resource);
             }
             log(resource.getName(), Project.MSG_VERBOSE);
             FileResource fileResource = (FileResource) resource;
             File file = fileResource.getFile();
             if (!file.exists()) {
                 throw new BuildException("Not found: " + file);
             }
             size += file.length();
             count++;
         }
         if (count == 0) {
             log("No files sized up", Project.MSG_WARN);
         }
         getProject().setNewProperty(property, Long.toString(size));
     }

It just shows how to go from a file to a fileset to resources.

the other interesting task does classpath setup and delegates to java

     /**
      * {@inheritDoc}
      * @throws org.apache.tools.ant.BuildException
      *          if something goes wrong with the build.
      */
     public void execute() {
         Java java=new Java();
         java.bindToOwner(this);
         java.init();
         java.setClasspath(classpath);
         java.setClassname(classname);
         java.setFailonerror(true);
         java.setFork(true);
         Iterator element = resources.iterator();
         while (element.hasNext()) {
             Resource resource = (Resource) element.next();
             java.createArg().setValue(resource.toString());
         }
         java.execute();
     }

Its a resource-enabled equivalent of <apply>, effectively. And you can 
see why I like toString() to be meaningful.

-steve




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: DO NOT REPLY [Bug 39780] New: - antunit doesnt set java.class.path

Posted by Matt Benson <gu...@yahoo.com>.
> this test works on the command line:
> 
>   <target name="testPath" depends="define">
>     <book:filesize property="size">
>       <path path="${java.class.path}"/>
>     </book:filesize> 
>     <echo> classpath size=${size}</echo>
>   </target>
> 
> but when run from antunit, it fails cos
> java.class.path isnt set.

Steve, I was noticing this filesize task you've got in
the "book" ns... I assume this relates to an example
that will go in the forthcoming revision to the
Manning book.  How does <book:filesize> differ from
the 1.6.3+ <length> task?

-Matt

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org