ant编译mysql驱动

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
云数据库 RDS MySQL,高可用系列 2核4GB
简介: 修改驱动源码后需要重新编译构建,由于mysql编译需要两个jdk版本且还需要hibernate4和junit,这里记录下。

修改驱动源码后需要重新编译构建,由于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" />
AI 代码解读
  • 上传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)
AI 代码解读
    <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" />
AI 代码解读
  • 执行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
AI 代码解读

========广告时间========

鄙人的新书《Tomcat内核设计剖析》已经在京东销售了,有需要的朋友可以到 https://item.jd.com/12185360.html 进行预定。感谢各位朋友。

为什么写《Tomcat内核设计剖析》

=========================

相关实践学习
如何快速连接云数据库RDS MySQL
本场景介绍如何通过阿里云数据管理服务DMS快速连接云数据库RDS MySQL,然后进行数据表的CRUD操作。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
打赏
0
0
0
0
36
分享
相关文章
【IDEA】java后台操作mysql数据库驱动常见错误解决方案
【IDEA】java后台操作mysql数据库驱动常见错误解决方案
226 0
【YashanDB知识库】原生mysql驱动配置连接崖山数据库
【YashanDB知识库】原生mysql驱动配置连接崖山数据库
【YashanDB知识库】原生mysql驱动配置连接崖山数据库
vb6读取mysql,用odbc mysql 5.3版本驱动
通过以上步骤,您可以在VB6中使用ODBC MySQL 5.3驱动连接MySQL数据库并读取数据。配置ODBC数据源、编写VB6代码
81 32
在 CentOS 7 中通过编译源码方式安装 MySQL 数据库的详细步骤,并与使用 RPM 包安装进行了对比
本文介绍了在 CentOS 7 中通过编译源码方式安装 MySQL 数据库的详细步骤,并与使用 RPM 包安装进行了对比。通过具体案例,读者可以了解如何准备环境、下载源码、编译安装、配置服务及登录 MySQL。编译源码安装虽然复杂,但提供了更高的定制性和灵活性,适用于需要高度定制的场景。
294 3
在 CentOS 7 中通过编译源码安装 MySQL 数据库的详细步骤,并与使用 RPM 包安装进行了对比。
本文介绍了在 CentOS 7 中通过编译源码安装 MySQL 数据库的详细步骤,并与使用 RPM 包安装进行了对比。内容涵盖准备工作、下载源码、编译安装、配置服务、登录设置及实践心得,帮助读者根据需求选择最适合的安装方法。
321 2
mysql5.7 jdbc驱动
遵循上述步骤,即可在Java项目中高效地集成MySQL 5.7 JDBC驱动,实现数据库的访问与管理。
1189 1
【编程基础知识】Eclipse连接MySQL 8.0时的JDK版本和驱动问题全解析
本文详细解析了在使用Eclipse连接MySQL 8.0时常见的JDK版本不兼容、驱动类错误和时区设置问题,并提供了清晰的解决方案。通过正确配置JDK版本、选择合适的驱动类和设置时区,确保Java应用能够顺利连接MySQL 8.0。
556 1
在 CentOS 7 中通过编译源码方式安装 MySQL 数据库的详细步骤
本文介绍了在 CentOS 7 中通过编译源码方式安装 MySQL 数据库的详细步骤,包括准备工作、下载源码、编译安装、配置服务等,并与使用 RPM 包安装进行了对比,帮助读者根据需求选择合适的方法。编译源码安装虽然复杂,但提供了更高的定制性和灵活性。
352 2
在 CentOS 7 中通过编译源码方式安装 MySQL 数据库的详细步骤
【10月更文挑战第7天】本文介绍了在 CentOS 7 中通过编译源码方式安装 MySQL 数据库的详细步骤,包括准备工作、下载源码、编译安装、配置 MySQL 服务、登录设置等。同时,文章还对比了编译源码安装与使用 RPM 包安装的优缺点,帮助读者根据自身需求选择合适的方法。
139 3