[英]external maven repo and jenkins
I have an external jar(meaning not available in a public repo), that i want o include in my build. 我有一个外部jar(意味着在公共仓库中不可用),我希望将其包含在我的构建中。 I used the instructions found on this site: http://charlie.cu.cc/2012/06/how-add-external-libraries-maven/ and it works, when I do mvn install in my PC. 我使用了以下网站上的说明: http : //charlie.cu.cc/2012/06/how-add-external-libraries-maven/,并且在我将mvn安装到PC上时也可以使用。 But when I am building the maven project using Jenkins, i get the following error: 但是,当我使用Jenkins构建Maven项目时,出现以下错误:
Executing Maven: -B -f D:\\Program Files (x86)\\Jenkins\\workspace\\rmy job\\pom.xml install [INFO] Scanning for projects... [INFO] 执行Maven:-B -f D:\\ Program Files(x86)\\ Jenkins \\ workspace \\ rmy job \\ pom.xml安装[INFO]扫描项目... [INFO]
[INFO] [信息]
[INFO] Building xxxxxx 0.0.1-SNAPSHOT [INFO] [INFO]建筑物xxxxxx 0.0.1-SNAPSHOT [INFO]
[WARNING] The POM for sqljdbc:sqljdbc_4.0:jar:v4 is missing, no dependency information available [警告]缺少sqljdbc:sqljdbc_4.0:jar:v4的POM,没有可用的依赖项信息
[INFO] [信息]
[INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total [INFO]建立失败[INFO] ------------------------------------------ ------------------------------ [INFO]总计
time: 1.705s [INFO] Finished at: Tue Feb 11 10:29:23 EET 2014 时间:1.705秒[INFO]完成时间:2014年2月11日星期二10:29:23
[INFO] Final Memory: 13M/307M [ERROR] Failed to execute goal on project xxxxxx: Could not resolve dependencies for project com.xx:xxxxxxx:jar:0.0.1-SNAPSHOT: Failure to find sqljdbc:sqljdbc_4.0:jar:v4 in http://repository.codehaus.org/org/codehaus was cached in the local repository, resolution will not be reattempted until the update interval of codehaus has elapsed or updates are forced -> [Help 1] [INFO]最终内存:13M / 307M [错误]无法在项目xxxxxx上执行目标:无法解析项目com.xx:xxxxxxx:jar:0.0.1-SNAPSHOT的依赖项:找不到sqljdbc:sqljdbc_4.0:jar http://repository.codehaus.org/org/codehaus中的:v4已缓存在本地存储库中,直到codehaus的更新间隔或强制执行更新后,才会重新尝试解析-> [帮助1]
The pom that i am using has these entries for repositories: 我正在使用的pom具有以下用于存储库的条目:
<repositories>
<repository>
<id>codehaus</id>
<url>http://repository.codehaus.org/org/codehaus</url>
</repository>
<!-- In Project repository -->
<repository>
<id>in-project</id>
<name>In Project Repo</name>
<url>file://${project.basedir}/libs</url>
</repository>
Any ideas why this is happening? 任何想法为什么会这样?
After some tries, i did the following workaround in pom.xml 经过一番尝试,我在pom.xml中做了以下解决方法
<repository>
<id>in-project</id>
<name>In Project Repo</name>
<url>file://${project.basedir}/libs</url>
</repository>
and 和
<dependency>
<groupId>sqljdbc</groupId>
<artifactId>sqljdbc_4.0</artifactId>
<version>v4</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/sqljdbc/sqljdbc_4.0/v4/sqljdbc_4.0-v4.jar</systemPath>
</dependency>
This means that the system path is needed as a whole and not just 这意味着系统路径是一个整体,而不仅仅是
<url>file://${project.basedir}/lib</url>
as it was mentioned above. 如上所述。 By this "workaround" I got it to work both locally and remotely (Jenkins-Git) 通过这种“变通方法”,我可以在本地和远程工作(Jenkins-Git)
As a general rule I always strongly recommend to 通常,我始终强烈建议
This is a key to get stable and reproducible builds - even when one of the repositories is temporarily unavailable. 这是获得稳定且可复制的内部版本的关键-即使其中一个存储库暂时不可用。
Actually that might be hppen that it can't get the jar from lib. 实际上,这可能是hppen无法从lib获取jar。
tyr it with other way. 用其他方式。
<repositories>
<repository>
<id>local123</id>
<name>localRepo</name>
<url>file://${project.basedir}/lib</url>
</repository>
</repositories>
try putting this code in pom.xml file. 尝试将这段代码放在pom.xml文件中。
hope your problem can be resolve using this. 希望您的问题可以使用此解决。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.