开发者社区> sea-boat> 正文
阿里云
为了无法计算的价值
打开APP
阿里云APP内打开

ant编译mysql驱动

简介: 修改驱动源码后需要重新编译构建,由于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" />
  • 上传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

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

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

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

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

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

相关文章
源码编译mysql
源码编译mysql
10 0
MySQL----DQL
数据查询语言
20 0
mysql task1
练习题 本笔记为阿里云天池龙珠计划mysql训练营的学习内容
62 0
MySQL 命令
版权声明:本文首发 http://asing1elife.com ,转载请注明出处。 https://blog.csdn.net/asing1elife/article/details/82892834 ...
1021 0
mysql错误及解决(1)
说明:如果遇到数据库出错的问题修改相应的代码后一般要重启mysql。如果遇到mysql的问题可以先重启一下mysql 看看问题能否解决。 1005:创建表失败  1006:创建数据库失败  1007:数据库已存在,创建数据库失败  1008:数据库不存在,删除数据库失败  1009:不能删除数据库文件导致删除数据库失败  1010:不能删除数据目录导致删除数据库失败  101
2045 0
+关注
sea-boat
擅长篮球、跑步、游泳、羽毛球、编程、看书、写书的顾家好男人! Java深度、大数据、中间件、搜索引擎、机器学习、深度学习、Python、C++、开源! 《Tomcat内核设计剖析》作者。
276
文章
0
问答
文章排行榜
最热
最新
相关电子书
更多
低代码开发师(初级)实战教程
立即下载
阿里巴巴DevOps 最佳实践手册
立即下载
冬季实战营第三期:MySQL数据库进阶实战
立即下载