maven本地仓库加入Sql Sever jar包

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 -DartifactId=sqljdbc4 -Dversion=4.0  

5) When you see Build Success, You can find the jar in your maven repository. Mine is located here:
6) Now you’re ready to add the dependency to pom.xml

< dependency>  
            < groupId></groupId>  
            < artifactId>sqljdbc4</artifactId>  
            < version>4.0</version>  
</ dependency> 
ghostsf wechat

评论完整模式加载中...如果长时间无法加载,请针对 | | 启用代理