简体   繁体   English

在pom中看不到maven settings.xml属性

[英]maven settings.xml properties are not seen in pom

i have in settings.xml following config 我在配置后在settings.xml中

<profile>
<properties>
<nexus.host>http://localhost:8081/nexus/content/repositories</nexus.host>
</properties>
</profile>

this profile is set as active. 此配置文件被设置为活动状态。

its used in distribution management section of pom 它用于pom的分发管理部分

<distributionManagement>
        <snapshotRepository>
            <id>my-snapshots</id>
            <name>my snapshots</name>
            <url>${nexus.path}/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>my-releases</id>
            <name>my releases</name>
            <url>${nexus.path}/releases</url>
        </repository>
    </distributionManagement>

this works when i run it on local machine, but when the job is executed on jenkins it fails with org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs: 当我在本地计算机上运行它时此方法有效,但是在jenkins上执行该作业时,它会失败,并出现org.apache.maven.project.ProjectBuildingException:处理POM时遇到一些问题:

[FATAL] Non-resolvable parent POM: Failure to transfer com.myapp:sample:pom:1.1.0 from ${nexus.path}/releases was cached in the local repository, resolution will not be reattempted until the update interval of my-releases has elapsed or updates are forced. [FATAL]不可解析的父POM:无法从$ {nexus.path} / releases转移com.myapp:sample:pom:1.1.0的版本缓存在本地存储库中,直到更新我的更新间隔后,才会重新尝试解析-版本已到期或强制进行更新。 Original error: Could not transfer artifact com.myapp:sample:pom:1.1.0 from/to my-releases (${nexus.path}/releases): Cannot access ${nexus.path}/releases with type default using the available connector factories: WagonRepositoryConnectorFactory and 'parent.relativePath' points at wrong local POM @ line 3, column 13 原始错误:无法从/到我的发行版($ {nexus.path} / releases)传输工件com.myapp:sample:pom:1.1.0:无法使用默认类型的$ {nexus.path} / releases访问可用的连接器工厂:WagonRepositoryConnectorFactory和'parent.relativePath'指向错误的本地POM @第3行,第13列

unable to identify the cause of the error 无法确定错误原因

I had the same issue in the past. 我过去也遇到过同样的问题。 To resolve this in Jenkins you will need to set the Maven argument so it can find the location of your settings.xml. 要在Jenkins中解决此问题,您将需要设置Maven参数,以便它可以找到settings.xml的位置。

You will need to have the settings.xml in the application resources so Jenkins can find it. 您将需要在应用程序资源中具有settings.xml,以便Jenkins可以找到它。

To set the argument(In Jenkins, it should be under Goals and options): 设置参数(在詹金斯中,应位于“目标和选项”下):

-s src/main/resources/settings.xml

However in my instance the Jenkins administrators provided a separate version of maven so the application will have the needed settings.xml and there was no need to provide our own custom settings.xml. 但是,在我的实例中,Jenkins管理员提供了单独的maven版本,因此该应用程序将具有所需的settings.xml,而无需提供我们自己的自定义settings.xml。

On a side note, you might want to contact the Jenkins Administrators to ensure that they have implemented the proper configurations so Jenkins will be able to deploy the produced artifacts to the repository under the id you have specified. 附带说明,您可能想与Jenkins管理员联系,以确保他们已经实施了正确的配置,因此Jenkins将能够使用您指定的ID将生成的工件部署到存储库中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM