Community
Participate
Working Groups
Build ID: I20080530-1730 Steps To Reproduce: 1.Create a simple Java project, which contains two packages A and B. Classes in Package B depends on classes defined in package A. 2. Using a Ant build file, which builds packages A into jar A, and package B in Jar B. 3.The problem is: if package A depends on 3rd party jars, and package B only depends Jar A. Now, the issue is the 3rd party jars needs to be in class path while compiling package B. I have tested in the J2SE 1.6.3 and 1.6.4. It works perfect fine in 1.6.3, means while switching to 1.6.3, Package B can be compiled with reference to jar containing package A only (no need to add the 3rd party libraries for compilation). I have checked the log files, it looks like while doing the compilation, it recompiles all source codes it depends (provided that the source codes are all in the same project). More information: I guess this is the issue with the J2SE build, it's not fair to put it as Eclipse or Ant issue. But since 1.6.4 is recommended in the target operation environment list of 3.4 work plan. This may be an issue. The issue appears in Build id: I20080530-1730 also.
Tried using J2SE 1.6.6, the issue appears either. This may be the issue with the J2SE build since 1.6.4. The question is: Eclipse has its own compiler or using the stand compiler? Workaround of this may be: While compiling, put all dependencies to build package B. But while packing the jar files, excludes the classes files created during compilation. Looks a little bit strange, but it can work.
Could you please provide an example project and the corresponding Ant build file that show the problem?
Re: comment 1 > The question is: Eclipse has its own compiler or using the stand compiler? Eclipse defines its own Java compiler used by the IDE. For Ant scripts, you need to toggle a property to use it, if not you are likely using the default javac tool. For instructions on how to use it in Ant task, please read section "Using the ant javac adapter" at http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.jdt.doc.isv/guide/jdt_api_compile.htm
(In reply to comment #3) > Re: comment 1 > > The question is: Eclipse has its own compiler or using the stand compiler? > > Eclipse defines its own Java compiler used by the IDE. For Ant scripts, you > need to toggle a property to use it, if not you are likely using the default > javac tool. > > For instructions on how to use it in Ant task, please read section "Using the > ant javac adapter" at > http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.jdt.doc.isv/guide/jdt_api_compile.htm > To clarify this point, I changed the Java builder section in Java Development User Guide to: The Java builder builds Java programs using its own compiler (the Eclipse Compiler for Java) that implements the Java Language Specification. The Java builder can build programs incrementally as individual Java files are saved. Note that the Eclipse Compiler for Java can also be invoked using Ant as described in the Using the ant javac adapter section of Compiling Java code
Please attach the sample projects & the ant script.
Closing as WORKSFORME. No news. Timed out!
Created attachment 165903 [details] Sample project for bug: 236164 Drag the build.xml into the Ant view: * buildA: it can run successfully to create a.jar into the ./libs folder * buildAll: it can run successfully to create a.jar and b.jar into the ./libs folder * buildB: this is where the issue is: if execute the buildA (i.e. run buildA separately), then run buildB, it will fail. But if add the <pathelement path="./libs/log4j-1.2.15.jar"/> into the classpath, it will be successfully. The interesting is: if we run buildAll, it can success (even without extra class path entry)
reopening for investigation.
I don't know whether i received email before but ignored or filtered by my email rules (outlook), I did not follow this issue. Thanks for follow up this issue. I just uploaded the sample project for re-creating the issue. Very sorry for this, hope it's not too late.
It seems to have been resolved by mistake, hence reopened again...
This is not related to Eclipse as is as you are not even calling the Eclipse compiler. You can debug it by using the build.xml I will attach to the bug report. Basically the problem comes from the fact that as soon as ClassA is retrieved from source you need the log4j jar on the classpath. Closing as NOT_ECLIPSE.
Created attachment 174785 [details] Build.xml that is using the Eclipse compiler and use a verbose mode You need to run this script from within Eclipse using the same JRE as the workspace (see the tabs in the launching configuration).
Verified for 3.7M1