11

我当时正在尝试按照本教程https://docs.mulesoft.com/mule-user-guide/v/3.7/building-a-mule-application-with-maven-in-studio创建一个 maven 项目当 Studio 自动构建 Maven 项目时,我收到了这个错误:updating maven project has encountered a problem There was an error running the studio:studio goal on project test在控制台中:

[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project com.mycompany:test:1.0.0-SNAPSHOT (C:\Users\Rajeun\AnypointStudio\workspace\test\pom.xml) has 2 errors
[ERROR]     Unresolveable build extension: Plugin org.mule.tools.maven:mule-app-maven-plugin:1.1 or one of its dependencies could not be resolved: Could not find artifact com.sun:tools:jar:1.5.0 at specified path C:\Program Files (x86)\Java\jre1.8.0_40/../lib/tools.jar -> [Help 2]
[ERROR]     Unknown packaging: mule @ line 8, column 16
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/PluginManagerException
4

9 回答 9

13

在您的任何工作室中转到 windows >> 首选项 >> 在左侧菜单中选择java >> 安装的 jre 将其更改为 jdk 路径 在此处输入图像描述

于 2015-11-09T22:47:04.430 回答
5

我解决了这个问题,我不知道究竟是什么工作,但我更改了 java 版本,并且对于每个项目我执行以下命令:

mvn clean install
mvn eclipse:eclipse

然后我刷新我的项目这可以帮助:http ://www.avajava.com/tutorials/lessons/how-do-i-update-my-maven-project-to-work-in-eclipse.html

于 2015-11-09T23:41:03.497 回答
3

我遇到了同样的问题,并通过在首选项中将 JRE 更改为 JDK 并重新启动任何点工作室来解决。这解决了我的问题。

于 2017-11-14T14:37:26.113 回答
2

我遇到了同样的错误,我不仅通过在已安装的 JRE 中添加 JDK 而是将 JAVASE-1.8 的执行环境设置为 jdk1.8 来解决它,并且它有效。 在此处输入图像描述

于 2017-02-01T18:31:22.153 回答
1

您需要为插件添加 Maven 依赖项

第 1 步:编辑 settings.xml 以添加具有以下存储库和 pluginRepositories 的新配置文件。(settings.xml 文件可能存在两个位置:$M2_HOME/conf/settings.xml 或 ${user.home}/.m2/settings.xml)

<profiles>
     ...
     <profile>
        <id>mule-extra-repos</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <repositories>
            <repository>
                <id>mule-public</id>
                <url> https://repository.mulesoft.org/nexus/content/repositories/public </url>
            </repository>
        </repositories>
        <pluginRepositories>
            <pluginRepository>
                <id>mule-public</id>
                <url> https://repository.mulesoft.org/nexus/content/repositories/public </url>
            </pluginRepository>
        </pluginRepositories>
     </profile>
     ...
 </profiles>

第二步:添加一个新的pluginGroup,如下图。

<pluginGroups>
    ...
    <pluginGroup>org.mule.tools</pluginGroup>
    ...
 </pluginGroups>

有关更多详细信息,您可以访问此页面https://docs.mulesoft.com/mule-user-guide/v/3.7/maven-tools-for-mule-esb

于 2016-03-18T03:31:02.257 回答
1

检查您的MuleStudio.ini是否包含 JDK 正确路径的配置:

-vm
C:\Path\To\Your\JDK\bin\javaw
于 2015-11-09T17:33:14.320 回答
0

我注意到,如果您的流程涉及 API Kit 和 Dataweave,则需要添加其他依赖项。

        <plugin>
            <executions>
                <execution>
                    <configuration>
                        <resources>
                            <resource>
                                <directory>src/main/api/</directory>
                            </resource>
                        </resources>
                    </configuration>
                </execution>
            </executions>
        </plugin>

    <dependency>
        <groupId>org.mule.modules</groupId>
        <artifactId>mule-module-apikit</artifactId>
        <version>${mule.version}</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.mulesoft.weave</groupId>
        <artifactId>mule-plugin-weave_2.11</artifactId>
        <version>${mule.version}</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.mule.modules</groupId>
        <artifactId>mule-module-http</artifactId>
        <version>${mule.version}</version>
        <scope>provided</scope>
    </dependency>
于 2016-06-29T04:42:44.643 回答
0

如果您在使用 Maven 构建项目时遇到来自 Anypoint Studio 的以下错误。

[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Unresolveable build extension: Plugin org.mule.tools.maven:mule-app-maven-plugin:1.2 or one of its dependencies could not be resolved: Could not find artifact com.sun:tools:jar:1.5.0 at specified path C:\Program Files\Java\jre1.8.0_162/../lib/tools.jar @ 
[ERROR] Unknown packaging: mule @ line 9, column 16
[WARNING] 'dependencies.dependency.systemPath' for com.sun:tools:jar refers to a non-existing file C:\Program Files\Java\jre1.8.0_162C:\Program Files\Java\jdk1.8.0_162\lib\tools.jar @ line 75, column 21
 @ 
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project com.mycompany:maven-test1:1.0.0-SNAPSHOT (C:\Users\Venkata Phanindra\AnypointStudio\workspace\maven-test1\pom.xml) has 2 errors
[ERROR]     Unresolveable build extension: Plugin org.mule.tools.maven:mule-app-maven-plugin:1.2 or one of its dependencies could not be resolved: Could not find artifact com.sun:tools:jar:1.5.0 at specified path C:\Program Files\Java\jre1.8.0_162/../lib/tools.jar -> [Help 2]
[ERROR]     Unknown packaging: mule @ line 9, column 16
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:

[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException

[ERROR] [Help 2] 
http://cwiki.apache.org/confluence/display/MAVEN/PluginManagerException

请按照以下步骤解决问题

  1. 从 Anypoint studio 转到 Windows -> 首选项 -> 已安装的 JRE。
  2. 这里将 JRE (C:\Program Files\Java\jre1.8.0_162) 更改为您的 JDK (C:\Program Files\Java\jdk1.8.0_162) 并选中 JDK 复选框并单击 Finish -> ok -> ok。

现在尝试通过右键单击 pom.xml 文件 Mule -> 更新项目依赖项来更新 pom.xml 文件。

如果您仍然遇到问题,请按照以下步骤操作:

  1. 转到 Windows -> 首选项 -> 已安装的 JRE -> 执行环境 这里选择 JavaSE-1.8 并在右侧窗口中单击 jdk1.8.0_162 [完美匹配],现在尝试更新项目依赖项。

这将解决问题。

于 2018-11-11T03:49:34.490 回答
0

我认为这是您的 mule studio Java 设置的问题。Mule studio 默认点 JRE 而不是 JDK。tools.jar 在 JDK 文件夹下可用。请参阅下面的链接,该链接告诉您如何将 JDK 添加到工作室,然后使用它来构建

http://www.gamefromscratch.com/post/2011/11/15/Telling-Eclipse-to-use-the-JDK-instead-of-JRE.aspx

于 2015-11-09T17:38:18.760 回答