2 Replies Latest reply on Mar 12, 2013 4:00 AM by thomas.diesler

    Allow Maven URLs to be configured to resolve external bundles

    ulrichromahn

      I have a general question for this community:

       

      Currently, JBoss OSGi allows to provide a Maven URI in standalone.xml or  domain.xml for a bunle which will then be resolved by the deployer according to the following rules:
      1. check if the artifact is present in a local Maven repo (.m2)
      2. if not, download the artifact from a remote Maven repo

      Currently, the class MavenArtifactRepository which appears to be responsible for the second path mentioned above has two Maven repository URLs hardcoded:
      JBOSS_NEXUS_BASE = "http://repository.jboss.org/nexus/content/groups/public";
      MAVEN_CENTRAL_BASE = "http://repo1.maven.org/maven2";

      It should be possible to configure those URLs using some configuration mechanism. This is especially important in a real production environment where access to external URLs may be blocked by a firewall and an internal Nexus repo should be used to proxy a "stable set" of artifacts to be used for production.

      The following configuration options should be possible:
      1. as it is right now
      2. switch off external resolution completely. Only artifacts currently present on the local filesystem (.m2) should be resolved and loaded
      3. Configure Maven URLs in addition to the hardcoded ones above
      4. Configure Maven URLs as complete replacements to the hardcoded ones above

       

      Is this something we should have?

       

      I already created a JIRA for this (https://issues.jboss.org/browse/JBOSGI-614).

       

      If we would implement this, what would be the best way to provide the configuration?

        • 1. Re: Allow Maven URLs to be configured to resolve external bundles
          dastraub

          Faced with the same problem, I developed a JBoss-Subsystem which registers an own repository.

          Feel free to use this https://dl.dropbox.com/u/7552537/repo-skeleton.zip and implement your logic in the class SampleRepository.

           

          19:39:32,857 INFO  [org.jboss.osgi.repository] (MSC service thread 1-11) JBOSGI020400: Find maven providers for: MavenCoordinates[commons-lang:commons-lang:jar:2.6]

          19:39:32,859 INFO  [org.jboss.osgi.repository] (MSC service thread 1-11) JBOSGI020401: Found maven resource: URLResource[org.apache.commons.lang:2.6.0]

          19:39:32,860 INFO  [training.samples.osgi.xrepo.SampleRepository] (MSC service thread 1-11) findProviders for commons-lang:commons-lang:jar:2.6

          19:39:33,122 INFO  [org.jboss.osgi.repository] (MSC service thread 1-11) JBOSGI020400: Find maven providers for: MavenCoordinates[commons-collections:commons-collections:jar:3.2.1]

          19:39:33,124 INFO  [org.jboss.osgi.repository] (MSC service thread 1-11) JBOSGI020401: Found maven resource: URLResource[org.apache.commons.collections:3.2.1]

          19:39:33,125 INFO  [training.samples.osgi.xrepo.SampleRepository] (MSC service thread 1-11) findProviders for commons-collections:commons-collections:jar:3.2.1

          ...

          • 2. Re: Allow Maven URLs to be configured to resolve external bundles
            thomas.diesler

            Daniel, would you be able to create a patch for what we have?