Anypoint Studio fails when running Maven project

2019-07-17 08:23发布

问题:

I am a Mule newbie and struggling to get the Anypoint Studio to work with Maven.

I used the mule-maven plugin to create a multi-module project and added my code to the apps sub-project. The project builds under maven and produces a zip file under the domain-bundle/target directory. The contents of the zip file looks reasonable.

When I tried to run the project (right click project/run as/Mule application with Maven) the project gets built by maven and then I get the following

Using as WTP server : null
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Full Domain bbc-demo Project ....................... SUCCESS [  0.264 s]
[INFO] Domain bbc-demo Project ............................ FAILURE [  0.323 s]
[INFO] Mule bbcwebservices Application .................... SKIPPED
[INFO] Mule bbcmetadata Application ....................... SKIPPED
[INFO] Mule bbcfilemonitor Application .................... SKIPPED
[INFO] Domain bbc-demo Applications ....................... SKIPPED
[INFO] Domain bbc-demo Bundle Project ..................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.195 s
[INFO] Finished at: 2015-11-20T12:56:17+13:00
[INFO] Final Memory: 15M/231M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.mule.tools:studio-maven-plugin:3.4.10:studio 
          (default-cli) on project bbc-demo-domain: 
           Execution default-cli of goal org.mule.tools:studio-maven-                 
          plugin:3.4.10:studio failed. NullPointerException -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e 

As can be see the error is related to the running the studio plugin - which is available in my maven repository.

Sometimes it fails in another way. The maven build appears to work correctly but Eclipse then displays the following error message

Unable to copy project zip file to the embedded Mule instance. 
Project: [Mule Project] Name: bbc-demo - Domain: default
Source 'AnypointStudio\workspace_anypoint\bbc-demo\target\bbc-demo-1-SNAPSHOT.zip' 
  does not exist

This is not un-surprising as the zip file it should be running is actually in 'workspace_anypoint\bbc-demo\ domain-bundle \target' directory with the name bbc-demo-domain-1-SNAPSHOT.zip

回答1:

This could be related to a bug related to the usage of the final name Maven element in Studio: STUDIO-6714. It is solved in Anypoint Studio 5.3. If you are using an older version try to update to the latest one.

Having said that, Studio doesn't support multi domain Maven projects. Some projects work and some don't.



回答2:

What is the packaging option you had set on your pom.xml? Try changing it to "mule" instead of "war".

<packaging>mule</packaging>

I was able to use this run my Mule 3.4 CE based application using Maven on Anypoint Studio 6.23