Maven Archetype项目存储库问题

问题描述

我已经从我现有的示例项目中创建了一个Maven原型项目。我将该jar文件发布到了https://maven.anypoint.mulesoft.com/api/v1/organizations/orgid/maven的存储库中。 当我尝试通过运行命令 mvn archetype:generate 创建项目时,出现错误,说无法在https://repo.maven.apache.org/maven2存储库中找到原型。 我尚未在maven settings.xml文件中配置repo.maven.apache.org。我应该对settings.xml进行哪些更改,以便它可以引用maven.anypoint.mulesoft.com存储库中的所需存储库。我还已经在settings.xml文件中配置了镜像

<mirror>
   <id>mirrorId</id>
   <mirrorOf>central</mirrorOf>
   <name>mule repo exchange</name>
   <url>https://maven.anypoint.mulesoft.com/api/v1/organizations/orgid/maven</url>
</mirror>

当我配置此镜像选项时,它给出错误-在当前项目中未找到前缀为'archetype'的插件

任何帮助表示赞赏

解决方法

Anypoint Exchange提供了Maven facade feature,以便能够发布某些类型的MuleSoft工件。它不打算用作常规用途的完整Maven存储库。根据{{​​3}},目前支持以下类型的对象:

  • 连接器
  • M子应用程序
  • 示例
  • 模板
  • 政策

您必须使用自己的存储库来处理这类事情。

,

如果您已经成功部署了原型,则使用原型存储库将Maven配置文件添加到您的设置中:

<profiles>
    <profile>
      <id>my-archetype-repository</id>
      <repositories>
        <repository>
          <id>archetype</id>
          <name>Mule Repository</name>
          <url>https://maven.anypoint.mulesoft.com/api/v1/organizations/<YOUR_ORG_ID>/maven</url>
          <releases>
            <enabled>true</enabled>
            <checksumPolicy>fail</checksumPolicy>
          </releases>
          <snapshots>
            <enabled>true</enabled>
            <checksumPolicy>warn</checksumPolicy>
          </snapshots>
        </repository>
      </repositories>
    </profile>
  </profiles>

然后使用该配置文件运行原型:

mvn archetype:generate -Pmy-archetype-repository

请不要忘记添加带有“原型”凭据的服务器。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...