maven添加第三方jar到本地(转)
2014-04-01 10:10
671 查看
添加格式:
mvn install:install-file
-Dfile=
-DgroupId=
-DartifactId=
-Dversion=
-Dpackaging=
-DgeneratePom=true
Where: the path to the file to load
the group that the file should be registered under
the artifact name for the file
the version of the file
the packaging of the file e.g. jar
然后将相应的jar拷到对应的目录下,在pom.xml文件中添加相应的denpendency,它的格式为:
Java代码 收藏代码
group-a
artifact-a
1.0
</dependency
下面提供一个样例,这里我要用到weblogic,本地有自有weblogic.jar,如是,
Java代码 收藏代码
mvn install:install-file
-Dfile=D:\lib\weblogic.jar
-DgroupId=weblogic
-DartifactId=weblogic
-Dversion=10.3
-Dpackaging=jar
-DgeneratePom=true
将weblogic.jar拷到C:\Documents and Settings\s.m2\repository\weblogic\weblogic路径下。
Java代码 收藏代码
weblogic
weblogic
10.3
然后在当前pom.xml路径下运行mvn package.
但奇怪的是编译不通过,出现如下错误:
Could not resolve dependencies for project com.sx.teest1:test1:jar:1.0-SNAPSHOT: Failure to find weblogic:weblogic:jar:10.3 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
在网上找了很久是update机制的问题,但是在.setting.xml文件后还是出现同样的错,苦思不得其解,然后比较了denpendency能使用的jar和这个denpendency的不同之处,最后发现刚才拷过来的jar没有相应的改文件名,这里由于刚才install的是10.3版本的jar,所以weblogic.jar应该改为weblogic-10.3.jar,改了之后再次运行就能通过了。看来还是自己粗心大意了。拷jar包的时候一定要相应的改jar包的名字。
另外还发现在Install的时候文件路径名不要有空格,否则会出现一些诡异的错误会让你崩溃的!
关于maven技术还在学习中,欢迎大家来拍砖,互相学习。
转自:http://susiya.iteye.com/blog/1601328
mvn install:install-file
-Dfile=
-DgroupId=
-DartifactId=
-Dversion=
-Dpackaging=
-DgeneratePom=true
Where: the path to the file to load
the group that the file should be registered under
the artifact name for the file
the version of the file
the packaging of the file e.g. jar
然后将相应的jar拷到对应的目录下,在pom.xml文件中添加相应的denpendency,它的格式为:
Java代码 收藏代码
group-a
artifact-a
1.0
</dependency
下面提供一个样例,这里我要用到weblogic,本地有自有weblogic.jar,如是,
Java代码 收藏代码
mvn install:install-file
-Dfile=D:\lib\weblogic.jar
-DgroupId=weblogic
-DartifactId=weblogic
-Dversion=10.3
-Dpackaging=jar
-DgeneratePom=true
将weblogic.jar拷到C:\Documents and Settings\s.m2\repository\weblogic\weblogic路径下。
Java代码 收藏代码
weblogic
weblogic
10.3
然后在当前pom.xml路径下运行mvn package.
但奇怪的是编译不通过,出现如下错误:
Could not resolve dependencies for project com.sx.teest1:test1:jar:1.0-SNAPSHOT: Failure to find weblogic:weblogic:jar:10.3 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
在网上找了很久是update机制的问题,但是在.setting.xml文件后还是出现同样的错,苦思不得其解,然后比较了denpendency能使用的jar和这个denpendency的不同之处,最后发现刚才拷过来的jar没有相应的改文件名,这里由于刚才install的是10.3版本的jar,所以weblogic.jar应该改为weblogic-10.3.jar,改了之后再次运行就能通过了。看来还是自己粗心大意了。拷jar包的时候一定要相应的改jar包的名字。
另外还发现在Install的时候文件路径名不要有空格,否则会出现一些诡异的错误会让你崩溃的!
关于maven技术还在学习中,欢迎大家来拍砖,互相学习。
转自:http://susiya.iteye.com/blog/1601328
相关文章推荐
- C++ Boost库 uBLAS 笔记
- java笔记之内部类
- 代码地址
- mmseg4j-1.9 solr4 bug 处理
- nodejs使用jquery风格环境安装
- C++计算程序运行时间
- ubuntu下面kill掉卡巴斯基shell脚本
- Jquery中使用setInterval和setTimeout
- Android TextView走马灯效果
- 树莓派学习笔记——RPi.GPIO 流水灯
- 网站访问慢怎么办?高并发高流量网站架构
- c 中typedef函数的用法
- 有关 ORA-00604 错误的总结
- Handler Looper源码解析(Android消息传递机制)
- PAT1002题解
- (转) 更改SQLServer实例默认字符集
- spark--spark9.0安装【1】
- C#设计模式系列:代理模式(Proxy)
- [iOS]使用Audio Queue Services 播放和录制音频
- 创新,有时是不经意间开放的花朵——访2013 CCF青年科学家奖获得者朱军