创建Maven项目时出错

创建Maven项目时出错,maven,mule,anypoint-studio,Maven,Mule,Anypoint Studio,我正试图通过遵循本教程创建一个maven项目。在Studio自动构建maven项目时,我遇到了以下错误:更新maven项目遇到了问题在项目测试中运行Studio:Studio目标时出错,在控制台中: [ERROR] The build could not read 1 project -> [Help 1] [ERROR] [ERROR] The project com.mycompany:test:1.0.0-SNAPSHOT (C:\Users\Rajeun\Anypoint

我正试图通过遵循本教程创建一个maven项目。在Studio自动构建maven项目时,我遇到了以下错误:
更新maven项目遇到了问题在项目测试中运行Studio:Studio目标时出错
,在控制台中:

[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

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

-vm
C:\Path\To\Your\JDK\bin\javaw

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


在anypoint studio中,转到windows>>preferences>>在左侧菜单上选择java>>已安装的jre将其更改为jdk path

我解决了问题,我不知道到底是什么起了作用,但我更改了java版本,并为每个项目执行以下命令:

mvn clean install
mvn eclipse:eclipse
然后我刷新我的项目 这会有所帮助:

您需要为插件添加Maven依赖项 步骤1:编辑settings.xml以添加具有以下存储库和pluginRepositories的新配置文件。(settings.xml文件可能位于两个位置:$M2_HOME/conf/settings.xml或${user.HOME}/.M2/settings.xml)


...
穆勒额外回购

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

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

src/main/api/


org.mule.modules
mule模块apikit
${mule.version}
假如
com.mulesoft.weave
mule-plugin-weave_2.11
${mule.version}
假如
org.mule.modules
mule模块http
${mule.version}
假如

我遇到了同样的错误,我解决了这个问题,不仅在已安装的JRE中添加了JDK,还将JAVASE-1.8的执行环境设置到jdk1.8中,并且成功了。

我也遇到了同样的问题,通过在preferences中将JRE更改为JDK并重新启动any point studio,我得到了解决。
这就解决了我的问题。

如果您在使用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
请按照以下步骤解决此问题

  • 从Anypoint studio转到Windows->Preferences->Installed JRE
  • 在这里,将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->updateprojectdependencies,尝试更新pom.xml文件

    如果您仍然面临问题,请执行以下另一步骤:

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

  • 这将解决问题。

    仍然存在相同的问题。请在这里找到我的anypointstudio.ini:我认为
    -vm
    参数必须在
    -vmargs
    之上(下面的行被传递给vm可执行文件)。文档()说JDK 8还不受支持,也许这仍然是事实…我尝试了java 6,然后我得到了错误,我的anypoit studio需要使用比版本6更多的版本,然后我使用java 7,仍然有相同的问题谢谢你的答复,但不幸的是,它没有为meI工作,我面临着同样的问题。解决了将JRE转换为JDK的问题。第一点是,在您的环境设置中,确保您的目标是JDK。对于我来说,即使在改变了环境变量之后,再次提出了同样的问题。这意味着Mule studio仍然指向JRE。下一步:在mule studio中,转到
    windows->preference->installedJRE
    将JRE更改为JDK。这对我有用。确保这两点都从您的角度完成。如果在命令行上从项目的根目录运行mvn studio:studio,是否会收到相同的错误消息?已尝试过,但不幸的是,它无法工作,非常感谢您的回答。您的pom.xml中有未知的包。您能为我们提供您的pom.xml的屏幕截图吗?
            <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>
    
    [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