1.配置(检查)Java环境变量
2.配置(检查)maven环境变量
3.找到maven文件的根目录下的config目录,修改setting.xml文件
配置maven本地仓库
- <!-- localRepository
- | The path to the local repository maven will use to store artifacts.
- |
- | Default: ${user.home}/.m2/repository
- <localRepository>/path/to/local/repo</localRepository>
- -->
- <!--配置maven本地仓库-->
- <localRepository>D:/java/to/local/repo</localRepository>
4.使用阿里*仓库
- <mirrors>
- <!-- mirror
- | Specifies a repository mirror site to use instead of a given repository. The repository that
- | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
- | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
- |
- <mirror>
- <id>mirrorId</id>
- <mirrorOf>repositoryId</mirrorOf>
- <name>Human Readable Name for this Mirror.</name>
- <url>http://my.repository.com/repo/path</url>
- </mirror>
- -->
- <!--使用阿里云-->
- <mirror>
- <id>nexus-aliyun</id>
- <mirrorOf>*</mirrorOf>
- <name>Nexus aliyun</name>
- <url>http://maven.aliyun.com/nexus/content/groups/public</url>
- </mirror>
- </mirrors>
5. 打开DOS窗口,执行:
mvn install:install-file -Dfile=C:/ojdbc5.jar -DgroupId=com.oracle -DartifactId=ojdbc5 -Dversion=5.0 -Dpackaging=jar -generatePom=true (如果报错就把-generatePom=true去掉)
-Dfile=c:/ojdbc5.jar 是指你ojdbc5.jar的文件位置
-DgroupId=com.oracle
-DartifactId=ojdbc5
-Dversion=5.0
指明了ojdbc5.jar的maven仓库位置。
6.在pom.xml文件中配置
- <dependency>
- <groupId>com.oracle</groupId>
- <artifactId>ojdbc5</artifactId>
- <version>5.0</version>
- </dependency>
7.右键点击项目-->Maven-->Update Project 此时就可以看到Maven Dependencies 有自己想要的jar包
在cmd中 mvn命令不能使用时 http://blog.csdn.net/u010782846/article/details/52775774
原链接 http://blog.csdn.net/maofachang/article/details/61932547