1 首先找到你的maven的配置文件{你maven的路径}\conf\settings.xml,然后打开settings.xml,并修改你存放本地jar路径。如我想把我自己的jar放到C:\Users\user\.m2\localRepository。
2 假如你自定义的jar包是123456.jar,你想在你项目的pom.xml中这样引入你的jar包
[html] view plain copy print ? <dependency> <groupId>123456</groupId> <artifactId>123456</artifactId> <version>1.0</version> </dependency> <dependency> <groupId>123456</groupId> <artifactId>123456</artifactId> <version>1.0</version> </dependency> 3 在你的文件夹下建立如下文件夹在C:\Users\user\.m2\localRepository\ 创建123456文件夹 ---->再创建123456文件夹----->再创建1.0文件夹
最后把123456.jar放到1.0文件夹下
转载请标明链接:http://blog.csdn.net/wabiaozia?viewmode=contents
如下图所示
4 把123456.jar改为123456-1.0.jar,并创建文件123456-1.0.pom
然后在123456-1.0.pom中写如下内容
[html] view plain copy print ? <project> <modelVersion>1.0.0</modelVersion> <groupId>123456</groupId> <artifactId>123456</artifactId> <version>1.0</version> </project> <project> <modelVersion>1.0.0</modelVersion> <groupId>123456</groupId> <artifactId>123456</artifactId> <version>1.0</version> </project> 5 在你的项目的pom.xml依赖中引入就行了 [html] view plain copy print ? <dependency> <groupId>123456</groupId> <artifactId>123456</artifactId> <version>1.0</version> </dependency> <dependency> <groupId>123456</groupId> <artifactId>123456</artifactId> <version>1.0</version> </dependency> 6 如果你的pom.xml报错然后勾选 force update of snapshots/releases 选项即可。
7 关于groupId,artifactId怎么写再举一例
jar包的位置
pom.xml中引入
[html] view plain copy print ? <dependency> <groupId>com.taibao</groupId> <artifactId>Butils</artifactId> <version>1.0</version> </dependency> <dependency> <groupId>com.taibao</groupId> <artifactId>Butils</artifactId> <version>1.0</version> </dependency>我博客所有文章链接:http://blog.csdn.net/wabiaozia?viewmode=contents
