0 Replies Latest reply on Mar 14, 2008 2:22 PM by luojoe

    Why I am getting an error "Unable to install Apache Maven facet"

    luojoe

      I just downloaded Fuse Eclipse Tooling 1.4.1 with Fuse Services Framework Tools 2.0.2 on my Eclipse platform 3.3.1.1. But when I tried to create a JBI project "File" -> "New" -> "Project" -> "Java Business Integration" -> "Service Unit", I got an error "Unable to install Apache Maven facet".

       

      The root cause of this error was due to the latest maven-archetype-plugin 2.0-alpha-2 was broken. For more details please have a look at the JIRA bug  ARCHETYPE-128

       

      According to ARCHETYPE-128 bug report, this issue had been fixed. However I do not believe it is in the latest maven-archetype-plugin version 2.0-alpha-2 yet. Therefore, if a project tries to use the latest maven-archetype-plugin with archetype version option "-DarchetypeVersion", it would fail. 

       

      If you are using Maven Command Line, then you have two ways to workaround this issue:

      1. You could explicitly specify an older but stable version of maven-archetype-plugin 1.0-alpha-7 from your maven command line. For instance:

       

      mvn org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7:create -DarchetypeGroupId=org.apache.servicemix.tooling -DarchetypeArtifactId=servicemix-service-unit -DarchetypeVersion=3.3.0.7-fuse -DgroupId=com.mycompany -DartifactId=jms-in-su -DremoteRepositories=http://repo.open.iona.com/maven2
      

       

       

      2. you could delete your latest maven-archetype-plugin version 2.0-alpha-2 from your local repository (~/.m2/repository) by deleting below directories:

       

      org\apache\maven\plugins\maven-archetype-plugin\2.0-alpha-2
      org\apache\maven\archetype\maven-archetype\2.0-alpha-2
      org\apache\maven\plugins\maven-archetype-plugin\2.0-alpha-2
      org\apache\maven\archetype\archetype-common
      

       

       

      And modifying the file

      org\apache\maven\plugins\maven-archetype-plugin\maven-metadata-central.xml
      

       

       

      From:

      <?xml version=&quot;1.0&quot;?><metadata>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-archetype-plugin</artifactId>
        <versioning>
          <latest>2.0-alpha-2</latest>
          <release>2.0-alpha-2</release>
          <versions>
            <version>1.0-alpha-3</version>
            <version>1.0-alpha-4</version>
            <version>1.0-alpha-7</version>
            <version>2.0-alpha-1</version>
            <version>2.0-alpha-2</version>
          </versions>
          <lastUpdated>20080219002715</lastUpdated>
        </versioning>
      </metadata>
      

       

       

      To:

      <?xml version=&quot;1.0&quot;?><metadata>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-archetype-plugin</artifactId>
        <versioning>
          <latest>1.0-alpha-7</latest>
          <release>1.0-alpha-7</release>
          <versions>
            <version>1.0-alpha-3</version>
            <version>1.0-alpha-4</version>
            <version>1.0-alpha-7</version>
          </versions>
          <lastUpdated>20080219002715</lastUpdated>
        </versioning>
      </metadata>
      

       

       

      so when you use default ?archetype:create? option in your command line:

       

      mvn archetype:create -DarchetypeGroupId=org.apache.servicemix.tooling -DarchetypeArtifactId=servicemix-service-unit -DarchetypeVersion=3.3.0.7-fuse -DgroupId=com.mycompany -DartifactId=jms-in-su -DremoteRepositories=http://repo.open.iona.com/maven2
      

       

       

      It won't go to maven central repository to download the latest maven-archetype-plugin 2.0-alpha-2 any more.

       

      If you are using Eclipse with Fuse Eclipse Tools, you also have two options to workaround this issue:

      1. You could use command line to create a JBI service unit, then you could do below command to create an Eclipse project from it:

      mvn eclipse:eclipse
      

       

      under the directory where you had created a JBI service unit. Note, you will need a pom file in order to successfully create an eclipse project.

       

      Then you need to port this project to the eclipse platform by:

      "File" -&gt; "Import" -&gt; "General" -&gt; "Existing Projects into Workspace".

       

      2. If you would like to stay away from Maven Command Line, you could run Maven in offline mode so that it won't fetch anything from any remote repositories out on the internet.

       

      Firstly you will need to make sure you have only the old version of the maven-archetype-plugin (for instance 1.0-alpha-7) in your local Maven repository , then you need to go to "Windows" -&gt; "Preferences..." -&gt; "Maven2" and check "Offline" checkbox. However, you will need to have all Fuse ESB dependencies and its transitive dependencies already in your local repository. Otherwise, you might get errors. The best way to make sure you have all FUSE ESB dependencies and its transitive dependencies in your local repository might be to use Maven command line to do "mvn clean install" on any old project that you had already created to force Maven to download any dependent libraries.

       

      Edited by: luojoe on Mar 14, 2008 2:22 PM