• Guide Tutorials Examples Services App notes Links FAQ Forum
  • Guide
    Tutorials
    Example Projects
    Documentation
    Service Catalog
    OSGi Specifications
    App Notes
    Where to Find Stuff
    Videos
    Known Issues
    Frequently Asked Questions
  • Prev Next

    This website and its associated repositories, are deprecated and no longer supported by the OSGi Alliance. Please visit https://enroute.osgi.org for the latest supported version of OSGi enRoute.

    This enRoute v2 archive site is kept for those who do not intend to use the latest version of OSGi enRoute. If you are new to OSGi enRoute, then please start with the latest OSGi enRoute.

    Continuous Integration

    What You Will Learn

    In this section we will use [Github] and [Travis], free services for developers when open source, to setup a continuous integration system.

    In this section it is assumed you’ve an account on Github and Travis.

    Creating a Github Repository

    So far we’ve created a repository but it is not yet a git repository and it is also not yet stored on Github.

    First step is to create a repository on Github with the required name: osgi.enroute.examples.eval. Once you’ve created this repository, we need to add it in our workspace.

    Committing the Repository

    First we should set .gitignore to ignore any files we do not want to include. In general, the following should work:

    osgi.enroute.examples.eval $ vi .gitignore
    // add the following content
    
    target/
    generated/
    */bin/
    */bin_test/
    */target/
    */generated/
    **/*.class
    **/*.jar
    

    We now need to connect the repository to Github (replace the xxxx with your user name):

    osgi.enroute.examples.eval $ git init
    osgi.enroute.examples.eval $ git add .
    osgi.enroute.examples.eval $ git commit -m "first commit"
    osgi.enroute.examples.eval $ git remote add origin git@github.com:xxxxxx/osgi.enroute.examples.eval.git
    osgi.enroute.examples.eval $ git push -u origin master
    

    Activating Travis

    After we’ve created the Github repository we can enable it on the Travis site (replace xxxx with your Github user id).

    • https://travis-ci.org/xxxxx

    You should click on your name in the right hand top corner and select Accounts. This opens a list of all your repositories. If you repository does not show up, you can push Sync Account. Flip the switch to on to activate your CI build.

    Preparing for Travis

    Travis is a free for open source continuous integration solution. By adding a simple file .travis.yml in the root of a Github repository we can build the workspace automatically.

    osgi.enroute.examples.eval $ vi .travis.yml
    // add the following content
    
    language: java
    
    jdk:
      - oraclejdk8
    
    before_install:
      - rm ~/.m2/settings.xml
    

    That is all! By default, Travis will call mvn install first without the tests and then later it will call mvn test to verify the results. Exactly what we need. This way we found any easy to find problems before we run long tests.

    We remove the settings because the default settings contain repositories we do not want to use in our build.

    So now save the change and commit it.

    osgi.enroute.examples.eval $ git add .travis.yml
    osgi.enroute.examples.eval $ git commit -m "Travis"
    osgi.enroute.examples.eval $ git push
    

    You can now go to the Travis site and watch our repo build:

    • https://travis-ci.org/xxxxx/osgi.enroute.examples.eval

    Prev Next
    • Copyright © 2021 OSGi™ Alliance.