修改驱动源码后需要重新编译构建,由于mysql编译需要两个jdk版本且还需要hibernate4和junit,这里记录下。

  • 安装ant。
  • 配置两个jdk,5和8。并修改build.xml配置,如下:
    <property name="com.mysql.jdbc.jdk5" value="/usr/java/jdk1.5.0_15" />
    <property name="com.mysql.jdbc.jdk8" value="/home/vagrant/java/jdk1.8.0_73" />
  • 上传hibernate4必须包到src/lib/hibernate4/下。
  • 上传junit包到src/lib/下。
  • 可能会出现如下报错,这个是jdk的bug,用的jdk版本是jdk-1_5_0_15,需要使用jdk1.5.0_22。
compile-testsuite:
     [echo] Compiling MySQL Connector/J testsuite with '/usr/java/jdk1.5.0_15' to './build/mysql-connector-java-5.1.40-SNAPSHOT'
    [javac] Compiling 62 source files to /home/vagrant/m2o-proxy/m2o-mysql-connector/build/mysql-connector-java-5.1.40-SNAPSHOT
    [javac] An exception has occurred in the compiler (1.5.0_15). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport)  after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report.  Thank you.
    [javac] java.lang.AssertionError: {rawtypes}
    [javac]     at com.sun.tools.javac.tree.TreeMaker$AnnotationBuilder.visitArray(TreeMaker.java:634)
    [javac]     at com.sun.tools.javac.code.Attribute$Array.accept(Attribute.java:124)
    [javac]     at com.sun.tools.javac.tree.TreeMaker$AnnotationBuilder.translate(TreeMaker.java:637)
    [javac]     at com.sun.tools.javac.tree.TreeMaker$AnnotationBuilder.visitCompoundInternal(TreeMaker.java:628)
    [javac]     at com.sun.tools.javac.tree.TreeMaker$AnnotationBuilder.translate(TreeMaker.java:641)
    [javac]     at com.sun.tools.javac.tree.TreeMaker.Annotation(TreeMaker.java:649)
    [javac]     at com.sun.tools.javac.tree.TreeMaker.Annotations(TreeMaker.java:570)
    [javac]     at com.sun.tools.javac.tree.TreeMaker.VarDef(TreeMaker.java:554)
    [javac]     at com.sun.tools.javac.comp.Lower.visitIterableForeachLoop(Lower.java:2892)
    [javac]     at com.sun.tools.javac.comp.Lower.visitForeachLoop(Lower.java:2755)
    [javac]     at com.sun.tools.javac.tree.Tree$ForeachLoop.accept(Tree.java:597)
    [javac]     at com.sun.tools.javac.comp.Lower.translate(Lower.java:1881)
    [javac]     at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:54)
    [javac]     at com.sun.tools.javac.tree.TreeTranslator.visitBlock(TreeTranslator.java:145)
    [javac]     at com.sun.tools.javac.comp.Lower.visitBlock(Lower.java:2927)
    <property name="com.mysql.jdbc.jdk5" value="/usr/java/jdk1.5.0_22" />
    <property name="com.mysql.jdbc.jdk8" value="/home/vagrant/java/jdk1.8.0_73" />
  • 执行ant成功编译。
[root@hb-localhost m2o-mysql-connector]# ant
Buildfile: /home/vagrant/m2o-proxy/m2o-mysql-connector/build.xml

-jdk5-check:

-jdk8-check:

-jre6-rtjar-check:

-compiler-check:

clean:
   [delete] Deleting directory /home/vagrant/m2o-proxy/m2o-mysql-connector/build

-init-copy-common:
    [mkdir] Created dir: /home/vagrant/m2o-proxy/m2o-mysql-connector/build
     [copy] Copying 364 files to /home/vagrant/m2o-proxy/m2o-mysql-connector/build/mysql-connector-java-5.1.40-SNAPSHOT
     [copy] Copied 52 empty directories to 1 empty directory under /home/vagrant/m2o-proxy/m2o-mysql-connector/build/mysql-connector-java-5.1.40-SNAPSHOT
     [copy] Copying 13 files to /home/vagrant/m2o-proxy/m2o-mysql-connector/build/mysql-connector-java-5.1.40-SNAPSHOT

-replace-headers-commercial:

-init-copy:

-extra-libs-check:

-init-filter-license:

-init-no-crypto:

init:

-clean-output:

-compile-driver-jdbc3:
     [echo] Compiling MySQL Connector/J JDBC 3 implementation with '/home/vagrant/java/jdk1.5.0_22' to './build/mysql-connector-java-5.1.40-SNAPSHOT'
    [javac] Compiling 218 source files to /home/vagrant/m2o-proxy/m2o-mysql-connector/build/mysql-connector-java-5.1.40-SNAPSHOT

-compile-driver-jdbc4:
     [echo] Compiling MySQL Connector/J JDBC 4+ implementation with '/home/vagrant/java/jdk1.8.0_73' to './build/mysql-connector-java-5.1.40-SNAPSHOT'
    [javac] Compiling 41 source files to /home/vagrant/m2o-proxy/m2o-mysql-connector/build/mysql-connector-java-5.1.40-SNAPSHOT
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.6
    [javac] 1 warning
    [javac] Compiling 8 source files to /home/vagrant/m2o-proxy/m2o-mysql-connector/build/mysql-connector-java-5.1.40-SNAPSHOT

compile-driver:

compile-testsuite:
     [echo] Compiling MySQL Connector/J testsuite with '/home/vagrant/java/jdk1.5.0_22' to './build/mysql-connector-java-5.1.40-SNAPSHOT'
    [javac] Compiling 62 source files to /home/vagrant/m2o-proxy/m2o-mysql-connector/build/mysql-connector-java-5.1.40-SNAPSHOT
    [javac] Compiling 5 source files to /home/vagrant/m2o-proxy/m2o-mysql-connector/build/mysql-connector-java-5.1.40-SNAPSHOT
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.6
    [javac] 1 warning
    [javac] Compiling 4 source files to /home/vagrant/m2o-proxy/m2o-mysql-connector/build/mysql-connector-java-5.1.40-SNAPSHOT

-compile-integration-c3p0:
     [echo] Compiling MySQL Connector/J-c3p0 integration with '/home/vagrant/java/jdk1.5.0_22' to './build/mysql-connector-java-5.1.40-SNAPSHOT'
    [javac] Compiling 1 source file to /home/vagrant/m2o-proxy/m2o-mysql-connector/build/mysql-connector-java-5.1.40-SNAPSHOT

-compile-integration-jboss:
     [echo] Compiling MySQL Connector/J-jboss integration with '/home/vagrant/java/jdk1.5.0_22' to './build/mysql-connector-java-5.1.40-SNAPSHOT'
    [javac] Compiling 1 source file to /home/vagrant/m2o-proxy/m2o-mysql-connector/build/mysql-connector-java-5.1.40-SNAPSHOT

-compile-integration-log4j:

compile-integration:

compile:

dist:
    [mkdir] Created dir: /home/vagrant/m2o-proxy/m2o-mysql-connector/build/META-INF
    [mkdir] Created dir: /home/vagrant/m2o-proxy/m2o-mysql-connector/build/mysql-connector-java-5.1.40-SNAPSHOT/META-INF/services
      [jar] Building jar: /home/vagrant/m2o-proxy/m2o-mysql-connector/build/mysql-connector-java-5.1.40-SNAPSHOT/mysql-connector-java-5.1.40-SNAPSHOT-bin.jar

BUILD SUCCESSFUL
Total time: 52 seconds

ant编译mysql驱动的更多相关文章

  1. QT编译Mysql驱动问题及解决方案

    默认情况下,qt 并没有自带mysql的数据库插件,需要自己编译先安装mysql server ,运行setup.exe时选择自定义安装,安装目录设为"D:\mysqldev"不要 ...

  2. QT编译mysql驱动

    一. 下载mysql C链接库 地址:http://dev.mysql.com/downloads/ 根据当前系统选择下载: 二. 安装下载好的mysql驱动文件 注意,一定要安装在不含有中文.空格以 ...

  3. Window下 Qt 编译MySQL驱动(居然用到了动态库格式转换工具)

    一步步在Window下开发Qt 今天开始安装MySQL,看了些关于MySQL安装的博文,方法大致相同,但是遇到的细节问题各有不同,或者没有讲全面,下面来说说个人的安装过程及遇到的问题. 1.首先下载, ...

  4. linux qt 5.12.6 编译mysql驱动

    环境:ubuntu 18.4 x64.qt 5.12.6 问题:安装后是没有mysql的驱动的 解决过程: 各种搜索,先后安装了mysql mysql-client,mysql-server,和各种l ...

  5. centos7下编译qt的mysql驱动

    在编译mysql驱动之前,首先要安装mysql,可以使用yum安装,这里将不再介绍. 在将qt和mysql都安装好之后,首先找到mysql的头文件以及他的共享库,我的mysql是使用yum安装的,头文 ...

  6. 解析Qt4.7.3编译MySql数据库驱动,存中文乱码、过滤转义字符问题

    问题:使用QSqlDataBase类建立连接MySql数据库驱动加载失败 QSqlDatabase: QMYSQL driver not loaded QSqlDatabase: available ...

  7. Qt5.7不能加载MySql驱动问题.(需要重新编译驱动)

    转自:http://blog.csdn.net/qq_28851503/article/details/52422302 首先贴上我遇到的问题,如下: QSqlDatabase: QMYSQL dri ...

  8. QT使用MySql的配置(使用addLibraryPath载入插件),编译QT的MySql驱动问题及解决方案(自己使用libmysql.lib进行编译mysql.pro,万不得已可以查看Makefile.Debug以解决问题)

    2010/04/23:Fixes : 更新批处理,以兼容WIN7. 第一次系统地玩QT,于是诞生了此预备式: [QT版本4.6.0(VS2008编译版),开发平台推荐使用Qt Creator(最新1. ...

  9. linux编译Qt+mysql驱动+可执行文件移植目标机

    前言: 如果希望自己的Qt/C++程序在目标机上运行,最简单的方法就是在目标机上安装一个Qtcreater[Qtxxx.run],然后编译release的可执行文件,直接拉起即可. 但是有些环境情况比 ...

随机推荐

  1. RPC服务和HTTP服务

    很长时间以来都没有怎么好好搞清楚RPC(即Remote Procedure Call,远程过程调用)和HTTP调用的区别,不都是写一个服务然后在客户端调用么?这里请允许我迷之一笑~Naive!本文简单 ...

  2. 四,前端---constructor与prototype

    这里对于constructor 和 prototype做一个简单的介绍,旨在让大家有一个简单的了解与认识 1:定义与用法 prototype:属性使您有能力向对象添加属性和方法. constructo ...

  3. [LeetCode] The Maze II 迷宫之二

    There is a ball in a maze with empty spaces and walls. The ball can go through empty spaces by rolli ...

  4. 音频降噪算法 附完整C代码

    降噪是音频图像算法中的必不可少的. 目的肯定是让图片或语音 更加自然平滑,简而言之,美化. 图像算法和音频算法 都有其共通点. 图像是偏向 空间 处理,例如图片中的某个区域. 图像很多时候是以二维数据 ...

  5. poj 1046 ——Color Me Less

    提交地址:http://poj.org/problem?id=1046 Color Me Less Time Limit: 1000MS   Memory Limit: 10000K Total Su ...

  6. [HNOI 2013]比赛

    Description 沫沫非常喜欢看足球赛,但因为沉迷于射箭游戏,错过了最近的一次足球联赛.此次联 赛共N支球队参加,比赛规则如下: (1) 每两支球队之间踢一场比赛. (2) 若平局,两支球队各得 ...

  7. ZOJ 3228 Searching the String(AC自动机)

    Searching the String Time Limit: 7 Seconds      Memory Limit: 129872 KB Little jay really hates to d ...

  8. 百度ML/DL方向面经

    最近败人品败得有些厉害,很多事都处理得不好--感觉有必要做点好事攒一攒. 虽然可能面试经过不是很有代表性,不过参考价值大概还是有的-- 由于当时人在国外,三轮都是电面-- 一面 当地时间早上5点半爬起 ...

  9. 【linux】---常用命令整理

    linux常用命令整理 一.ls命令 就是list的缩写,通过ls 命令不仅可以查看linux文件夹包含的文件,而且可以查看文件权限(包括目录.文件夹.文件权限)查看目录信息等等 常用参数搭配: l ...

  10. JAVAEE——BOS物流项目10:权限概述、常见的权限控制方式、apache shiro框架简介、基于shiro框架进行认证操作

    1 学习计划 1.演示权限demo 2.权限概述 n 认证 n 授权 3.常见的权限控制方式 n url拦截权限控制 n 方法注解权限控制 4.创建权限数据模型 n 权限表 n 角色表 n 用户表 n ...