3 Replies Latest reply on Jun 1, 2012 6:03 PM by sully6768

    Building custom repo for offline deployments

    eric.bender

      I have been using the documentation found at http://fusesource.com/docs/esb/4.4/esb_deploy_osgi/Locate-CustomRepo.html to ensure my organization can deploy to production environments without outside access.

       

      My question is, how would I add non-features to a process like this?  In other words if I have an external dependency on velocity-tools that is not a feature and is just a dependency, how can I add it to this process?  For clarity here is a copy of the current POM.

       

      On a related note, how do I specify specific versions in this process?

       

      <project xmlns="http://maven.apache.org/POM/4.0.0" 
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.mytest</groupId>
        <artifactId>custom-repo</artifactId>
        <version>1.0</version>
        <name>Generate offline features repository</name>
        
      
          <build>
              <plugins>
                <plugin>
                  <groupId>org.apache.karaf.tooling</groupId>
                  <artifactId>features-maven-plugin</artifactId>
                  <version>2.2.1</version>
      
                  <executions>
                    <execution>
                      <id>add-features-to-repo</id>
                      <phase>generate-resources</phase>
                      <goals>
                        <goal>add-features-to-repo</goal>
                      </goals>
                      <configuration>
                        <descriptors>
                          <!-- List the URLs of required feature repositories here -->
                          <descriptor>mvn:org.apache.karaf.assemblies.features/standard/2.2.2-fuse-02-13/xml/features</descriptor>
                          <descriptor>mvn:org.apache.karaf.assemblies.features/enterprise/2.2.2-fuse-02-13/xml/features</descriptor>
                          <descriptor>mvn:org.apache.servicemix.nmr/apache-servicemix-nmr/1.5.1-fuse-01-13/xml/features</descriptor>
                          <descriptor>mvn:org.apache.servicemix/apache-servicemix/4.4.1-fuse-01-13/xml/features</descriptor>
                          <descriptor>mvn:org.apache.camel.karaf/apache-camel/2.8.0-fuse-01-13/xml/features</descriptor>
                          <descriptor>mvn:org.apache.activemq/activemq-karaf/5.5.1-fuse-01-13/xml/features</descriptor>
                        </descriptors>
                        <features>
                               <feature>camel-flatpack</feature>
                               <feature>camel-velocity</feature>
                               <feature>camel-http</feature>
                        </features>
                        <repository>target/features-repo</repository>
                      </configuration>
                    </execution>
                  </executions>
                </plugin>
              </plugins>
          </build>
        
          <repositories>
            <repository>
              <id>repo1.maven.org</id>
              <name>Maven Central</name>
              <url>http://repo1.maven.org/maven2</url>
              <snapshots>
                <enabled>false</enabled>
              </snapshots>
              <releases>
                <enabled>true</enabled>
              </releases>
            </repository>
      
            <repository>
              <id>repo.fusesource.com</id>
              <name>Fusesource</name>
              <url>http://repo.fusesource.com/nexus/content/repositories/releases</url>
              <snapshots>
                <enabled>false</enabled>
              </snapshots>
              <releases>
                <enabled>true</enabled>
              </releases>
            </repository>
      
            <repository>
              <id>repo.fusesource.com.snapshots</id>
              <name>Fusesource Snapshots</name>
              <url>http://repo.fusesource.com/nexus/content/repositories/snapshots@snapshots@noreleases</url>
              <snapshots>
                <enabled>true</enabled>
              </snapshots>
              <releases>
                <enabled>true</enabled>
              </releases>
            </repository>
      
            <repository>
              <id>repository.apache.org</id>
              <name>Apache Snapshots</name>
              <url>http://repository.apache.org/content/groups/snapshots-group@snapshots@noreleases</url>
              <snapshots>
                <enabled>true</enabled>
              </snapshots>
              <releases>
                <enabled>false</enabled>
              </releases>
            </repository>
      
            <repository>
              <id>svn.apache.org</id>
              <name>Apache</name>
              <url>http://svn.apache.org/repos/asf/servicemix/m2-repo</url>
              <snapshots>
                <enabled>false</enabled>
              </snapshots>
              <releases>
                <enabled>true</enabled>
              </releases>
            </repository>
      
            <repository>
              <id>repository.springsource.com</id>
              <name>Springsource Releases</name>
              <url>http://repository.springsource.com/maven/bundles/release</url>
              <snapshots>
                <enabled>false</enabled>
              </snapshots>
              <releases>
                <enabled>true</enabled>
              </releases>
            </repository>
      
            <repository>
              <id>repository.springsource.com.external</id>
              <name>Springsource External</name>
              <url>http://repository.springsource.com/maven/bundles/external</url>
              <snapshots>
                <enabled>false</enabled>
              </snapshots>
              <releases>
                <enabled>true</enabled>
              </releases>
            </repository>
      
          </repositories>
       </project>
      

       

        • 1. Re: Building custom repo for offline deployments
          sully6768

          Hi Eric,

           

          My assumption is that your dependency on velocity-tools is part of a developed application.  If that is the case, the easiest would be to generate a feature for your application that requires the additional dependency and then include the that feature URI in your descriptor list and then add the name of the feature to the plugin configuration.

           

          Best Regards,

          Scott ES

           

          Edited by: sully6768 on Jun 1, 2012 9:59 PM

          • 2. Re: Building custom repo for offline deployments
            eric.bender

            Alright, just to clarify, in this case what would go into the new feature, just the velocity-tools component, or would you build the feature around the developed application as well as it's singular dependencies? 

             

            Do you have an example of what the URI to a local feature would look like?  I assume instead of mvn: it would be a file:/location/feature.xml or such.

             

            Any extra information would be helpful.

             

            Thanks!

            • 3. Re: Building custom repo for offline deployments
              sully6768

              Typically you will want to use features for any installation into the container to take advantage of its two step provisioning.  This helps to limit issues when adding new components to the container.

               

              There are several ways to deal with feature creation.  First I would refer to the documentation on that very subject:

               

              http://fusesource.com/docs/esb/4.4.1/esb_deploy_osgi/DeployFeatures-Create.html

               

              From there you can decide if you want to automate generating the file or creating it manually.

               

              If you decide that generating the XML manually is the way to go, I suggest placing it in the src/main/resources directory of your primary or assembly project.  This will allow you to filter it for property replacement for things like the version numbers of your dependencies.  An example of how to configure it in your Maven POM can be found here:

               

              https://gist.github.com/2855275

               

              If you want to automate its generation you can use the Karaf Features Maven Plugin.  This will automatically generate the file and attach it to your build.  I have created an example of how to use it with Maven here:

               

              https://gist.github.com/2855304

               

              In both of these cases I refer to attaching the features XML to the build which means it will be deployed to your local, and remote if you use a central remote for development, repositories which then allows you to use the same 'mvn' URI when referencing it in your repository generator.

               

              With either of these options you will be able to find your newly minted feature XML in the local repository under groupId/artifactId/version/artifact-version-features.xml

               

              Thanks,

              Scott ES

               

              Edited by: sully6768 on Jun 1, 2012 10:01 PM