ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shankar Unni <shan...@intruvert.com>
Subject Problem with <rmic> in Ant 1.4
Date Thu, 06 Sep 2001 18:14:54 GMT
In my project, I have a "src" directory with all the Java source files, and
want to build the thing into a "classes" directory. So far, so good. I also
want to "rmic -iiop" a file, and have the *generated source files* in a
"gen" directory (so that "ant clean" can clean up easily, but at the same
time, I don't want those .java files to clutter up my Jar file).

I'm trying to use the <rmic> task as follows:

    <rmic base="${build}"
          sourcebase="${gen}" 
          iiop="yes" 
          debug="${debug}"
          stubversion="-v1.2" 
          classname="com.intruvert.ext.fault.FaultHandlerServiceImpl"
          classpathref="default.class.path"/>

This worked in 1.3, but in 1.4, the task fails with the message (long path
prefixes replaced by PATH to make the message readable):

PATH\build.xml:46: Failed to copy
PATH\classes\package\FaultHandlerServiceImpl.java to
PATH\gen\package\FaultHandlerServiceImpl.java due to
PATH\classes\package\FaultHandlerServiceImpl.java (The system cannot find
the file specified)

Notice that it seems to assume that the .java file for the .class file being
rmic'ed is also a generated file under the "base" directory.  But the "base"
directory points to where the *class files* are, not where the original
*source files* are (and they can be different!).

The offending code in Rmic.java is (~line 402):

        /* 
         * Move the generated source file to the base directory.  If
         * base directory and sourcebase are the same, the generated
         * sources are already in place.
         */
        if (null != sourceBase && !baseDir.equals(sourceBase)) {
            if (idl) {
                log("Cannot determine sourcefiles in idl mode, ", 
                    Project.MSG_WARN);
                log("sourcebase attribute will be ignored.",
Project.MSG_WARN);
            } else {
                for (int j = 0; j < fileCount; j++) {
                    moveGeneratedFile(baseDir, sourceBase,
                                      (String) compileList.elementAt(j),
                                      adapter);
                }
            }
        }

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). 

(Of course, in 1.3, it used to simply leave some of the generated files in
the "base" directory, but 1.4 seems to swing too far in the other
direction..)


My workaround for this is to specify "base" and "sourcebase" as the same,
and let it leave the ".java" files there, and move them by hand later.


--
Shankar Unni            IntruVert Networks, Inc.
shankar@intruvert.com   (408) 434-8311


Mime
View raw message