简体   繁体   English

Maven Bnd 存储库插件无法从远程工件获取工件

[英]Maven Bnd Repository Plugin fails to fetch artifact from remote artifactory

I'm trying to get bnd tools structure working (started with tutorial https://bndtools.org/tutorial.html )我正在尝试使 bnd 工具结构正常工作(从教程https://bndtools.org/tutorial.html开始)

Added use of javax.vecmath (as simple library as I could think of) in cnf/central.maven filecnf/central.maven文件中添加了javax.vecmath (我能想到的简单库)的使用

javax.vecmath:vecmath:1.5.2

and added it to build path in org.example.impl with everything resolving just fine.并将其添加到org.example.impl中的构建路径,一切都解决得很好。

I have fork of this library in jFrog artifactory running on remote server, so next step was defining that repository in cnf/build.bnd adding (as described in https://bnd.bndtools.org/plugins/maven.html )我在远程服务器上运行的 jFrog 工件中有这个库的分支,所以下一步是在cnf/build.bnd添加定义该存储库(如https://bnd.bndtools.org/plugins/maven.html中所述)

-plugin.10.Remote = \
    aQute.bnd.repository.maven.provider.MavenBndRepository; \
        releaseUrl=https://artifactory.website.com/artifactory/libs-release-local/; \
        snapshotUrl=https://artifactory.website.com/artifactory/libs-snapshot-local/; \
        index=${.}/release.maven; \
        name="Maven Remote"

and appropriate reference in cnf/release.maven以及cnf/release.maven中的适当参考

javax.vecmath:vecmath:2.1.5

When adding this library to build path I get error "2.1.5 [Could not fetch javax.vecmath:vecmath:2.1.5]" with no further information.将此库添加到构建路径时,我收到错误“2.1.5 [无法获取 javax.vecmath:vecmath:2.1.5]”,没有更多信息。

I figured the only difference between maven central and my artifactory should be content of .m2/settings.xml with credentials (according to https://bnd.bndtools.org/instructions/connection-settings plugin should look there in the first place). I figured the only difference between maven central and my artifactory should be content of .m2/settings.xml with credentials (according to https://bnd.bndtools.org/instructions/connection-settings plugin should look there in the first place) .

Configuration that works for maven in eclipse (when I open a maven project that has vecmath 2.1.5 as dependency it gets pulled without a problem to .m2/repository/javax/vecmath/vecmath/2.1.5 and once there it gets resolved just fine by bnd) Configuration that works for maven in eclipse (when I open a maven project that has vecmath 2.1.5 as dependency it gets pulled without a problem to .m2/repository/javax/vecmath/vecmath/2.1.5 and once there it gets resolved just由bnd罚款)

<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <servers>
    <server>
      <username>username</username>
      <password>roigonsdnglosgnoisfgnsdjgnlafjksasgnl</password>
      <id>central</id>
    </server>
    <server>
      <username>username</username>
      <password>roigonsdnglosgnoisfgnsdjgnlafjksasgnl</password>
      <id>snapshots</id>
    </server>
  </servers>
  <profiles>
    <profile>
      <repositories>
        <repository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>libs-release</name>
          <url>https://artifactory.website.com/artifactory/libs-release</url>
        </repository>
        <repository>
          <snapshots />
          <id>snapshots</id>
          <name>libs-snapshot</name>
          <url>https://artifactory.website.com/artifactory/libs-snapshot</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>libs-release</name>
          <url>https://artifactory.website.com/artifactory/libs-release</url>
        </pluginRepository>
        <pluginRepository>
          <snapshots />
          <id>snapshots</id>
          <name>libs-snapshot</name>
          <url>https://artifactory.website.com/artifactory/libs-snapshot</url>
        </pluginRepository>
      </pluginRepositories>
      <id>artifactory</id>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>artifactory</activeProfile>
  </activeProfiles>
</settings>

From this it seems bnd has no problem fetching from maven central to local m2 repository and using it from there, but fails to connect to my artifactory.由此看来,bnd 从 maven 中央到本地 m2 存储库并从那里使用它似乎没有问题,但无法连接到我的工件。 Is there some key setting or difference I'm missing?我缺少一些关键设置或差异吗?

Ended up solving the issue with help from https://groups.google.com/forum/#!forum/bndtools-users having found two (three?) problems with my configuration.最终在https://groups.google.com/forum/#!forum/bndtools-users的帮助下解决了问题,发现我的配置存在两个(三个?)问题。

The correct form for repository definition in build.bnd seems to be build.bnd中存储库定义的正确形式似乎是

-plugin.10.Remote: \
    aQute.bnd.repository.maven.provider.MavenBndRepository; \
        releaseUrl=https://artifactory.website.com/artifactory/libs-release-local/; \
        snapshotUrl=https://artifactory.website.com/artifactory/libs-snapshot-local/; \
        index=${.}/release.maven; \
        name="Maven Remote"

Looking in https://bnd.bndtools.org/instructions/connection-settings server auth configuration for bnd differs from maven configuration (0.3.4, for some reason I missed that part)查看https://bnd.bndtools.org/instructions/connection-settings服务器身份验证配置的 bnd 不同于 maven 配置(0.3.4,由于某种原因我错过了那部分)

<server>
  <username>username</username>
  <password>roigonsdnglosgnoisfgnsdjgnlafjksasgnl</password>
  <id>https://*website.com</id>
</server>

and bnd is looking for connection settings first in .bnd , if there are none, then in .m2 , but if there are incorrect/insufficient settings in .bnd it does not look in .m2 even if it contains correct/sufficient ones.并且 bnd 首先在.bnd中查找连接设置,如果没有,则在.m2中,但是如果.bnd中的设置不正确/不足,即使它包含正确/足够的设置,它也不会在.m2中查找。

The default order in which bnd looks for settings is:
`~/.bnd/connection-settings.xml`
`~/.m2/settings.xml`

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

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