You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Jens v.P." <de...@jevopi.de> on 2001/12/17 13:37:47 UTC

rmic and sourcebase (bug?)

Hello Ant Users,

  I've got a little problem with the rmic task: The sourcebase
attribute is not working as expected.

  Example set up:
- class foo, foo.class somewhere in classpath
- build.xml fragment

<target name="rmic">
  <mkdir dir="${build.classes}" />
  <mkdir dir="${build.src}"/>

  <rmic base="${build.classes}" stubversion="1.2"
       classname="foo"
       sourcebase="${build.src}">
    <classpath>
      <pathelement path="${build.classes}"/>
      <path refid="lib.path"/>
    </classpath>
   </rmic>
</target>

  What I expect rmic to do is the following:
  1) create ${build.classes}/foo_stub.java
  2) compile it to ${build.classes}/foo_stub.class
  3) copy (move) foo_stub.java to ${build.java}/foo_stub.class

  1) and 2) are working perfectly well - but 3) is not executed
successfully. Using "-verbose", the following error message *) is printed
out:

---------------8X--------------------8X---------------
C:\...\build.xml:84: Failed to copy C:\...\build\classes\foo.java
 to C:\...\build\src\foo.java
 due to C:\...\build\classes\foo.java (Das System kann die angegebene Datei nicht finden)
     (trans: file not found)
        at org.apache.tools.ant.taskdefs.Rmic.moveGeneratedFile(Rmic.java:449)
        at org.apache.tools.ant.taskdefs.Rmic.execute(Rmic.java:414)
        ...
 --- Nested Exception ---
java.io.FileNotFoundException: C:\...\build\classes\foo.java
                               (file not found)
        ...
        at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:225)
        at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:162)
        at org.apache.tools.ant.Project.copyFile(Project.java:733)
        at org.apache.tools.ant.taskdefs.Rmic.moveGeneratedFile(Rmic.java:444)
        ...
---------------8X--------------------8X---------------
  *) I've truncated the error message to make it better readable.
  
  Is this a bug? I assume foo_stub.java has to be copied, _not_
foo.java. Of course foo.java is _not_ found in .../build/classes, it's
a source file which doesn't matter here because it was compiled
before.

  I found another message in this mailinglist (without an answer) by
Shankar Unni who found the same error but interpreted it different. He
wrote

> But it looks like *some* of the compile list files are NOT generated (for
> some reason, <rmic> seems to want to recompile the original source file for
> the class I'm rmic'ing).

He also wrote that it was working with ANT version 1.3, I'm using
"Ant version 1.4.1 compiled on October 11 2001".

Of course I can implement the same workaround as Shankar used: simply
copy the generated java sources using the copy task... but this is
just a workaround...


Best regards,
 Jens


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>