11
votes

I'm trying to create a maven project by following this tutorial https://docs.mulesoft.com/mule-user-guide/v/3.7/building-a-mule-application-with-maven-in-studio that time that time when Studio builds the Maven Project automatically, I get this error : updating maven project has encountered a problem There was an error running the studio:studio goal on project test and in the console:

[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
9
I have faced the same problem. Resolved shifting JRE to JDK . First point is, in your environment setting make sure your are pointing JDK. For me even after changing environment variable again raised with the same problem. Which means Mule studio is still pointing the JRE. Next step : In mule studio, go to windows->preference->InstalledJREs change the JRE to JDK. This worked for me. Make sure these two points are done from your end. - star
Do you get the same error message if you run mvn studio:studio from the root directory of the project on the command line? - Ryan Hoegg

9 Answers

13
votes

in your anypoint studio go to windows >> preferences >> on the left hand menu select java >> installed jre change it to jdk path enter image description here

5
votes

I solved the problem, I don't know exactly what has worked but I changed the java version and for every project I execute the following commands:

mvn clean install
mvn eclipse:eclipse

and then i refresh my project This can help: http://www.avajava.com/tutorials/lessons/how-do-i-update-my-maven-project-to-work-in-eclipse.html

3
votes

I have faced same issue and got resolved by changing the JRE to JDK in preferences and restarted the any point studio. This resolved the issue to me.

2
votes

I was getting the same error and I solved it by not just adding JDK in the installed JREs but setting Execution environment of JAVASE-1.8 to jdk1.8 and it worked. enter image description here

1
votes

Check whether your MuleStudio.ini contains the configration for the correct path of your JDK:

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

You need to add the Maven Dependency for the Plugin

Step 1: Edit settings.xml to add a new profile with the following repositories and pluginRepositories. (There are two locations where a settings.xml file may live: $M2_HOME/conf/settings.xml or ${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>

Step 2: Add a new pluginGroup, as shown below.

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

For more details, you can visit this page https://docs.mulesoft.com/mule-user-guide/v/3.7/maven-tools-for-mule-esb

0
votes

I think that is problem with your mule studio Java setting. Mule studio by default points JRE not JDK. tools.jar is available under JDK folder. See the below link which tell you how to add JDK to studio then use that to build

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

0
votes

I noticed that if your flow involves API Kit and Dataweave, additional dependencies need to be added.

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

and

    <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>
0
votes

If you are facing with below error from Anypoint studio when building project with Maven.

[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

Please follow the below steps to resolve the issue

  1. From Anypoint studio goto Windows -> Preferences -> Installed JREs.
  2. Here change the JRE (C:\Program Files\Java\jre1.8.0_162) to your JDK (C:\Program Files\Java\jdk1.8.0_162) and select the JDK checkbox and click Finish -> ok -> ok.

Now try to update the pom.xml file by Right clicking the pom.xml file Mule -> Update project dependencies.

If still you are facing the issue follow the another step as below:

  1. Goto Windows -> preferences -> Installed JREs -> Execution Environment Here select JavaSE-1.8 and on right window click on the jdk1.8.0_162 [perfect match] and now try to Update project dependencies.

This will solve the issue.