mwjhw216 发表于 2018-10-12 09:03:09

安装SQL Server驱动到Maven仓库

  Maven does not directly support some libraries, like Microsoft’s SQLServer JDBC. This tutorial will show you how to add an externaldependency to your local Maven repository. It assumes you have alreadyinstalled Maven.
Download the JDBC driver for Microsoft SQL Server

[*]Visit the MSDN site for SQL Server and download the latest version of the JDBC driver for your operating system.
[*]Unzip the package
[*]Open a command prompt and switch into the expanded directory where the jar file is located.
[*]Execute the following command. Be sure to modify the jar file name and version as necessary:
mvn install:install-file -Dfile=sqljdbc4.jar -Dpackaging=jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=4.0 You should see something similar to this: Scanning for projects... ------------------------------------------------------------------------ Building Maven Stub Project (No POM) 1 ------------------------------------------------------------------------ --- maven-install-plugin:2.3.1:install-file (default-cli) @ standalone-pom --- Installing /Users/claude/installers/JDBC/sqljdbc_4.0/enu/sqljdbc4.jar to /Users/claude/.m2/repository/com/microsoft/sqlserver/sqljdbc4/4.0/sqljdbc4-4.0.jar Installing /var/folders/c6/q1bdtq557kv54783p1g6cbsw0000gp/T/mvninstall1874482299687761721.pom to /Users/claude/.m2/repository/com/microsoft/sqlserver/sqljdbc4/4.0/sqljdbc4-4.0.pom ------------------------------------------------------------------------ BUILD SUCCESS ------------------------------------------------------------------------ Total time: 1.208s Finished at: Tue Mar 13 14:07:31 EDT 2012 Final Memory: 3M/81M ------------------------------------------------------------------------Modify your POM
  Include the new dependency by modifying your project’s pom.xml. Add the following dependency:
    com.microsoft.sqlserver    sqljdbc4    4.0  Save the pom.xml file and build the project to make sure no errors exist.

页: [1]
查看完整版本: 安装SQL Server驱动到Maven仓库