Bug #68664 Enable packaging of Connector/J in Eclipse
Submitted: 13 Mar 2013 20:58 Modified: 12 Apr 2013 14:15
Reporter: Todd Farmer (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:5.1.24 OS:Any
Assigned to: Todd Farmer CPU Architecture:Any

[13 Mar 2013 20:58] Todd Farmer
Description:
The Ant task which produces Connector/J JAR packages for distribution doesn't work in Eclipse.  There is special logic in the Ant script which redirects compilation target to the bin/ directory, for Eclipse compatibility:

    <!-- Send class files to correct location if running in eclipse -->

    <condition property="compiler.output" value="bin" else="${buildDir}/${fullProdName}">
        <or>
            <isset property="eclipse.running" />
            <isset property="eclipse.pdebuild.home" />
            <contains string="${ant.home}" substring="plugins" />
        </or>
    </condition>

This is used in all compile-related tasks:

    <target name="compile-driver-jdbc3" depends="init, -clean-output">
        <javac sourcepath="" srcdir="${buildDir}/${fullProdName}"
            destdir="${compiler.output}"
... 

But not in the jar task:

        <jar jarfile="${buildDir}/${fullProdName}/${fullProdName}-bin.jar"
            basedir="${buildDir}/${fullProdName}" 

The result is that a .JAR file is produced with no errors when packaging in Eclipse, but include no compiled .class files. 

How to repeat:
Try to produce .JAR package from Eclipse using Ant tasks.

Suggested fix:
Change the jar task to reference  ${compiler.output} instead of {buildDir}/${fullProdName}.
[12 Apr 2013 14:15] Bugs System
Added changelog entry to 5.1.25:

Producing Connector/J JAR packages in Eclipse using Ant tasks would result
in a JAR file without compiled class files. Compile-related tasks in the
Ant script would direct compilation targets to the "bin" directory (for
Eclipse compatibility), while JAR related tasks were directed to
"{buildDir}/${fullProdName}". This fix changes the JAR task reference to
"${compiler.output}" instead of "{buildDir}/${fullProdName}".

Please advise if changelog entry requires revision.