您的位置:首页 > 数据库

Sql Sever 2008 jar Maven pom.xml dependency

2012-12-01 00:22 253 查看
When I add sqlserver04.jar into my maven project, it's a little bit different others. For other jars, I directly add dependency into pom.xml. For sqlserver.jar, the dependency works on others' projects, but not mine. It always give me an error about missing
artifact. Here is my solution:

1) download latest jar
Microsoft download center. I download *.exe file.

2) Run the exe file and unzip it.

3) Open a command prompt and switch into the directory whre the jar file is located

4) Execute the comand

mvn install:install-file -Dfile=sqljdbc4.jar -Dpackaging=jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=4.0


5) When you see Build Success, You can find the jar in your maven repository. Mine is located here:

C:\Users\****\.m2\repository\com\microsoft\sqlserver\sqljdbc4\4.0

6) Now you're ready to add the dependency to pom.xml

<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
</dependency>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: