【问题标题】:unable to use the GraphQL router for MuleSoft components无法将 GraphQL 路由器用于 MuleSoft 组件
【发布时间】:2021-06-17 23:42:12
【问题描述】:

我正在尝试将 GraphQL 路由器用于 MuleSoft 组件,该组件可在 MuleSoft 实验室 GitHub 存储库https://github.com/mulesoft-labs/graphql-router 获得

在本地系统中创建了一个文件夹:graphql-demo。在命令提示符下键入以下命令:

git 克隆https://github.com/mulesoft-labs/graphql-router.git

在我的本地系统中克隆项目后,我转到 pom.xml 并将 mule-modules-parent 版本从 1.0.0 更改为 1.1.3。

从克隆项目的位置转到命令提示符并运行命令:

mvn 全新安装

项目未搭建成功,请协助。

错误: 在处理 POM 时遇到了一些问题: 可解析的构建扩展:插件 org.mule.runtime.plugins:mule-extensions-maven-plugin:1.1.6 或其依赖项之一无法解析:无法读取 org.mule.rntime.plugins:mule- 的工件描述extensions-maven-plugin:jar:1.1.6.

我正在尝试了解如何将 GraphQL 与 mulesoft 一起使用,任何建议都会有所帮助。

这是为 Mulesoft 使用 GraphQL 的正确方法吗?

【问题讨论】:

  • 在github问题上提问?

标签: graphql mulesoft


【解决方案1】:

您的问题中缺少实际的根错误:

Caused by: org.eclipse.aether.transfer.NoRepositoryConnectorException: Blocked mirror for repositories: [mulesoft-plugin-releases (http://repository.mulesoft.org/releases/, default, releases+snapshots), mulesoft-plugin-snapshots (http://repository.mulesoft.org/snapshots/, default, releases+snapshots)]

问题在于较新的 Maven 版本增加了对带有 http:... URL 的存储库的安全限制。您可以通过为失败但将它们指向https:... URL 的存储库添加未阻止的镜像来解决该问题。在 Maven settings.xml 文件的 <mirrors> 元素中添加这个 sn-p:

    <mirror>
      <id>my-repository-http-unblocker1</id>
      <mirrorOf>mulesoft-plugin-releases</mirrorOf>
      <name></name>
      <url>http://repository.mulesoft.org/releases/</url>;
      <blocked>false</blocked>
    </mirror>

    <mirror>
      <id>my-repository-http-unblocker2</id>
      <mirrorOf>mulesoft-plugin-snapshots</mirrorOf>
      <name></name>
      <url>http://repository.mulesoft.org/snaphosts/</url>;
      <blocked>false</blocked>
    </mirror>    

确保使用 JDK 8(如 OpenJDK 8)完成构建,否则可能因其他原因而失败。

请注意,graphql-router 是一个开源社区项目,几年未更新,不是 MuleSoft 官方产品。

【讨论】:

  • 非常感谢您的帮助。在我的 Maven Setting.xml 中添加镜像元素后,我的构建成功。这是使用 GraphQL 的正确方法吗?我们有 Mulesoft 推荐的其他选择吗?
  • 如果您的意思是 Mule 运行时,我不知道其他官方组件。其他 MulesSoft 产品以不同方式支持 GraphQL。这取决于你想做什么。没有正确的答案。
  • “确保使用 JDK 8 完成构建,例如 OpenJDK 8,否则可能会因其他原因而失败。”这是否意味着我们不应该安装 8 以外的 JDK 版本?喜欢 OpenJDK 11?在我的个人计算机上构建失败,我不确定有什么不同。
  • 你可以安装任何你想要的 Java 版本,只要确保在这个特定的构建中使用 JDK 8。在我切换使用的版本之前,我遇到了 JDK 11 的问题。
  • 这意味着什么? [错误] 无法在项目 mule-module-graphql 上执行目标 org.bsc.maven:maven-processor-plugin:2.2.4:process (process):执行错误:java.lang.ExceptionInInitializerError:java.lang.reflect。 InaccessibleObjectException-->Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError 可访问:模块 java.base 不会“打开 java.lang”到未命名的模块 @57ad1178
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-05-25
  • 2017-08-29
  • 2019-07-27
  • 2018-05-01
  • 1970-01-01
  • 2016-08-09
相关资源
最近更新 更多