Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Open SRP Client is now made up of various maven published aar libraries which are then included in a project's build to aggregate the various functionality it offers.

These modules/libraries are:

  • opensrp-client-core
  • opensrp-client-growth-monitoring
  • opensrp-client-native-form
  • opensrp-client-immunization

Uploading to Maven

All the above projects have the same structure as far as configuration.

To upload files to maven,

  • Update the gradle.properties file in the root of the project to change the VERSION_NAME  and/or the VERSION_CODE. If building for a snapshot, include the word 'SNAPSHOT' in the version name. If building for release DO NOT include the suffix. Thus for a Non-snapshot release, it would read VERSION_NAME=1.0.0

          

     fig.1: example for opensrp client core

  • Update the file located in ~/.gradle/gradle.properties with your credentials for nexus. If the file does not exist in your workstation, create it. 

...

./gradlew :android-json-form-wizard:uploadArchives -PmavenLocal=true

Viewing artifacts Maven

To see if the upload was successful you can visit: https://oss.sonatype.org/content/groups/public/org/smartregister/

Using/Including the artifacts in a project

...

    compile('org.smartregister:opensrp-client-core:1.0.0-SNAPSHOT@aar') {
transitive = true
}
NB: Remember to include transitive=true inorder for the aar dependencies to be included too

...

  • Update the file located in ~/.gradle/gradle.properties with your signing key id, password and secret key-ring file path. 

...

     fig.3: example of gradle.properties file global setting with the signing credentials
  • Update the gradle.properties file in the project and remove the '-SNAPSHOT' suffix. e.g for the opensrp-client-core example It should look like this now .

...

When refreshing dependencies as you add code changes to the various modules in the org.smartregister package, you need to clear the local gradle and maven cache with the following in order the latest changes to reflect... so run

rm -rf ~/.m2/repository/org/smartregister/

and then run 

rm -rf ~/.gradle/caches/modules-2/files-2.1/org.smartregister/

and then

./gradlew clean build --refresh-dependencies


Development efficiency

During development it might be inefficient to publish minor updates to the library even on maven local just to test your new changes or during debugging. Thus when developing it is recommended to include the library dependency by using the compile project syntax. e.g when developing the opensrp-client-growth-monitoring library include the library in the sample project using this syntax in sample's build.gradle

compile project(":opensrp-growth-monitoring")