6 Replies Latest reply on Oct 25, 2012 8:11 PM by plord_plord

    Adding Features Repository

    plord_plord

      I am trying to load a features respository into an FMC profile based on the example here:

      http://fusesource.com/docs/esbent/7.0/esb_getting_started/Develop-Feature.html

       

      I have built the feature project and deployed it to my maven repo and verified it is there in the repo.

       

      I am trying to load the feature into a new profile to be deployed into the Fabric.

       

      I have added the repos to the org.fusesource.fabric.agent.properties config file under the org.ops4j.pax.url.mvn.repositories property. This works for deploying profiles to containers, but does not seem to work for features.

       

      I add my repository to the Profile:

      mvn:org.fusesource.example/get-started/1.0-SNAPSHOT/xml/features

       

      when i try to load a feature though, i get an error:

       

      Error fetching features repository: URL mvn:org.fusesource.example/get-started/1.0-SNAPSHOT/xml/features could not be resolved.

       

       

      How do I tell FMC where to retrieve the feature from?

       

      I also tried setting the repository URL to:

      mvn:http://host:port/repopath/org.fusesource.example/get-started/1.0-SNAPSHOT/xml/features

       

      bu it did not like that either.

        • 1. Re: Adding Features Repository
          stlewis

          Have a look at the "default" profile in FMC and go to the Config Files tab.  In there you'll see org.fusesource.fabric.agent.properties, click on that.  In the properties file you'll see there's an org.ops4j.pax.url.mvn.repositories setting, you can add your repo there.

           

          A better option though is to deploy your artifacts directly to fabric.  You can set up your build like so:

           

            <!-- Set up the build to deploy artifacts to the fabric server -->
          
            <distributionManagement>
              <repository>
                <id>fabric-maven-proxy</id>
                <name>FMC Maven Proxy</name>
                <!-- Change to your target host -->
                <url>http://admin:admin@${deploy-host}:8107/maven/upload/</url>
              </repository>
            </distributionManagement>
          

           

          Update "deploy-host" and the port (8107) to values that suit your environment.  Then deploy with an "mvn install deploy".  The artifacts then get served out to containers by the FMC/fabric server.  Also note that they're stored in the ~/.m2/repository folder of the user account running FMC or the fabric server depending on how you've set things up.

           

          If you've got time I'm doing a webinar this afternoon at 3:00 EDT and will be deploying an example using this method.

          • 2. Re: Adding Features Repository
            plord_plord

            Thats the thing, I already added my repos to this setting in the default profile. Here is the value of it:

             

            org.ops4j.pax.url.mvn.repositories= \

                http://repo1.maven.org/maven2, \

                http://repo.fusesource.com/nexus/content/repositories/releases, \

                http://repo.fusesource.com/nexus/content/groups/ea, \

                http://repository.springsource.com/maven/bundles/release, \

                http://repository.springsource.com/maven/bundles/external, \

                http://scala-tools.org/repo-releases, \

                http://host:port/artifactory/libs-releases-local, \

                http://host:port/artifactory/libs-snapshots-local, \

                http://host:port/artifactory/ext-snapshot-local, \

                http://host:port/artifactory/ext-release-local

             

            I have verified that the features xml file is there in the repo that was added, but it is still unable to resolve it.

            In addition, I am able to install bundles that are in the same repo. It is just the feature which is not working.

             

            I am not sure that the direct deploy to the fabric will work for us long term, since our local maven repo is where we put our releases for distribution to test and production.

             

            Edited by: plord on Oct 17, 2012 4:42 PM

            • 3. Re: Adding Features Repository
              stlewis

              Ah, try adding @snapshots to your repository entries, looks like the pax maven url handler disables snapshots from remote repositories by default (look here under "Marking repositories as containing releases / snapshots (starting with release 0.2.1)")

              • 4. Re: Adding Features Repository
                plord_plord

                I was able to get this to work. What I had to do is to add the feature repo to the profile and then add the profile to at least one container and have it deploy. This apparently forced FMC to download the features xml file, which then made it available in the Features tab of the profile without the error.

                 

                Any explanation for this?

                 

                I will try the @snapshots annotation as well.

                • 5. Re: Adding Features Repository
                  stlewis

                  Ah yes, I get it now.  So the difference is that FMC is resolving that artifact locally to display the features repository, i.e. the code just relies on the mvn URL resolver to get that file.  In this case where FMC has also created the fabric it's instance of the pax url handler for maven is still looking at the configuration in etc/org.ops4j.pax.url.mvn.cfg and not in any profile.

                   

                  So by deploying a container you basically get fabric's maven proxy to download the artifact to the local repo, at which point then that code in FMC that's resolving the URL can also see it.

                   

                  Will have to do some experimenting here, for example it may be that simply refreshing the pax url maven resolver bundle in the FMC container may make it start working, as then it'll pick up it's configuration via fabric's config admin bridge.

                   

                  So good catch!  Pretty sure it's a bug, so logged it here

                  • 6. Re: Adding Features Repository
                    plord_plord

                    the work around works for now.