在sqljdbc4.jar的路徑下,打開命令行輸入:sql
mvn install:install-file -Dfile=sqljdbc4.jar -Dpackaging=jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=4.0
對jar包進行安裝,輸入結果以下:apache
[INFO] Scanning for projects... Downloading: http://maven.aliyun.com/nexus/content/repositories/central/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom Downloaded: http://maven.aliyun.com/nexus/content/repositories/central/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom (3.9 kB at 16 kB/s) [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Maven Stub Project (No POM) 1 [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom --- [INFO] Installing C:\Users\pengu\Desktop\連發工具\sqljdbc4.jar to D:\Applications\apache-maven\.m2\repository\com\microsoft\sqlserver\sqljdbc4\4.0\sqljdbc4-4.0.jar [INFO] Installing C:\Users\pengu\AppData\Local\Temp\mvninstall7139818648049157779.pom to D:\Applications\apache-maven\.m2\repository\com\microsoft\sqlserver\sqljdbc4\4.0\sqljdbc4-4.0.pom [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.501 s [INFO] Finished at: 2017-10-23T23:32:37+08:00 [INFO] Final Memory: 9M/130M [INFO] ------------------------------------------------------------------------
在maven裏引用:bash
<dependency> <groupId>com.microsoft.sqlserver</groupId> <artifactId>sqljdbc4</artifactId> <version>4.0</version> </dependency>