2 Replies Latest reply on Nov 18, 2010 4:35 PM by Peter Chandler

    ServiceMix and mvn repos access

    Peter Chandler Master

      I have a local mvn repository on my LAN (not my host) that I am deploying my bundles to. The repo requires username/password. I would like to install my bundles from this local repo directly into servicemix (ex. install mvn:...  )

       

      So: in etc/org.ops4j.pax.url.mvn.cfg I added:

      org.ops4j.pax.url.mvn.repositories= ... , 
      http\://username\:password@repo.my.company.com/content/repositories/
      

       

      The can't install anything from this repo "URL: whatever could not be resolved."

      Questions: Is this going to work? Does "org.ops4j.pax.url.mvn.repositories" support repos with authentication? Is there a way to test connectivity with this repo?

       

      When I built/depoyed my bundle I added "". Which then append -osgi onto the jar name.

      Question: Does the mvn: URL in servicemix allow for classifier? i.e., Can I install a bundle, via mvn URL, that has a classifier? Example please?

       

      The ServiceMix mvn: URL syntax is

      mvn:[repository_url!]groupId/artifactId[/[version]/[type]]
      

      Question: what is type?

       

      Sorry for all the questions.

       

      Peter.

        • 1. Re: ServiceMix and mvn repos access
          Freeman(Yue) Fang Master

          Hi,

           

          About your questions

          Questions: Is this going to work? Does "org.ops4j.pax.url.mvn.repositories" support repos with authentication? Is there a way to test connectivity with this repo?

           

          Yes, "org.ops4j.pax.url.mvn.repositories" support it, as we have internal restrict repo and we configure it this way like

          http://your_username:your_password@your_resctrict_repo/...

          To test the  connectivity with restrict repo I think you can

          configure your maven settings.xml, add

           

           

          and create a maven project on your local machine which need download artifacts from restrict repo,  to see if it works.

           

          Question: Does the mvn: URL in servicemix allow for classifier? i.e., Can I install a bundle, via mvn URL, that has a classifier? Example please?

           

          More details please take a look at ,

          actually the syntax is

          mvn-uri := 'mvn:' group-id / artifact-id [ classifier ] ] ] ]

           

          Here is an example I can come up with

          mvn:org.apache.camel.karaf/apache-camel/2.4.0-fuse-01-00/xml/features

          group-id org.apache.camel.karaf

          artifact-id apache-camel

          version 2.4.0-fuse-01-00

          type xml

          classifier features

           

           

           

          http://wiki.ops4j.org/display/paxurl/Mvn+Protocol

           

          Freeman

           

          Edited by: ffang on Nov 11, 2010 2:22 AM

           

          Edited by: ffang on Nov 11, 2010 2:23 AM

          • 2. Re: ServiceMix and mvn repos access
            Peter Chandler Master

            Freeman,

             

            Thanks I got this working.

             

            For the record (help someone else), I did have an issue with maven 2.x, repository, deployment, classifiers, metadata and snapshots.

             

            I implemented my bundle by adding a "osgi" maven classifier. I then deploying the bundle to Nexus (the repository). When the bundle is created in Nexus the timestamp/build-number is NOT getting added, because the artifact's classifier isn't included in the repository's metadata (maven-metadata.xml).

             

            When I did a karaf@root> install mvn:..., org.ops4j.pax.url.mvn would use the timestamp/build-number in the metadata and no jar existed.

             

            java.lang.RuntimeException: URL [mvn:com.inc.headoffice/project/1.9-SNAPSHOT/jar/osgi] could not be resolved.
            

             

            Note: fix in maven 3.0.