DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
NB! This is still draft with work in progress!
Fineract-CN projects depend on each other. The simplest option is to build them all locally so artifacts are published to local maven repository and available from there.
Sometomes still there is need to only work with a single project and resolve the other fineract-cn-* dependencies from public repository.
Also in order for travis-ci to build some specific project it needs all the dependencies to be available.
JFrog Artifactory has been set up to host these artifacts since Maven Central is not suitable for the task (as it doesn't hold "work-in-progress" snapshots).
In this artifacotry there are two repositories:
- libs-release - project releases (currently empty)
- libs-snapshot - snapshot builds. These are updated every time something new gets pushed to git.
In order to use snapshot builds one needs to have following line in repositories list:
repositories {
jcenter()
mavenLocal()
maven { url 'https://mifos.jfrog.io/mifos/libs-snapshot/' }
}
How snapshots are built
All apache/fineract-cn-* repositories are configured to be built with Travis-CI. Whenever something is pushed to a repository travis tries to run gradle build on it. Travis also detects the current branch that the changes were pushed to.
If travis detects that the changes were pushed to "develop" branch and build doesn't fail then it uploads the new snapshot artifacts to the public repository.
If your branch is not named "develop"
Then the build script sets version name of your artifact to "branchname-". So if normally you would refer to lang like this:
dependencies {
compile(
[group: 'org.apache.fineract.cn', name: 'lang', version: '0.1.0-BUILD-SNAPSHOT']
)
)To refer to the artifact built from branch "myfeature" you would have to use something like this:
dependencies {
compile(
[group: 'org.apache.fineract.cn', name: 'lang', version: 'myfeature-SNAPSHOT']
)
)
How releases work
Implementation
This is needed if you want to set up a new project or change existing setup.
Configure a new fineract-cn-* project to upload artifacts to artifactory
- in build.gradle:
- If not already, add snapshots repository to list of repositories so it looks like this:
repositories {
jcenter()
mavenLocal()
maven { url 'https://mifos.jfrog.io/mifos/libs-snapshot/' }
} - In list of plugins add plugin:
id "com.jfrog.artifactory" version "4.9.5" - In publishing → publications → projectnamePublification
replaceversion project.version
with:version findProperty('externalVersion') ?: project.version
- Underheath publishing block add instructions for the new plugin:
artifactory {
contextUrl = System.getenv("ARTIFACTORY_URL")
publish {
repository {
repoKey = project.property('artifactoryRepoKey')
username = System.getenv("ARTIFACTORY_USER")
password = System.getenv("ARTIFACTORY_PASSWORD")
}
defaults {
publications ('langPublication')
}
}
}
artifactoryPublish.dependsOn('clean','publishToMavenLocal')
- If not already, add snapshots repository to list of repositories so it looks like this:
- Add travis banner to top of README.md (replace reponame with correct value):
[](https://travis-ci.com/apache/fineract-cn-reponame)
- Add travis.sh (copy-paste from other project that is already included)
- Add .travis.yml - travis-ci.com looks for this file
language: java
sudo: false
jdk:
- openjdk8
install: true
script: "./travis.sh"
env:
global:- BUILD_SNAPSHOTS_BRANCH=travis
- ARTIFACTORY_URL=https://mifos.jfrog.io/mifos
- ARTIFACTORY_USER=travis-ci1
- secure: "see below chapter Encrypt Artifactory password"
Encrypt Artifactory password
You need command line travis client.
travis encrypt --com -r apache/fineract-cn-reponame ARTIFACTORY_PASSWORD=enter-password-here
copy the encrypted secure value to .travis.yml
Verify
- If you push to "develop" branch the code is uploaded to https://mifos.jfrog.io/mifos/libs-snapshot-local/org/apache/fineract/cn/<projectname>/0.1.0-BUILD-SNAPSHOT/<projectname>-0.1.0-BUILD-SNAPSHOT.jar
- If you push to any other branch, for example to branch "myfeature" then the code is uploaded to https://mifos.jfrog.io/mifos/libs-snapshot-local/org/apache/fineract/cn/<projectname>/myfeature-SNAPSHOT/<projectname>-myfeature-SNAPSHOT.pom
- If you create a realease in Github (out of any branch), and name it let's say "1.2.0.0" then travis builds the code and uploads to https://mifos.jfrog.io/mifos/libs-release-local/org/apache/fineract/cn/<projectname>/1.2.0.0/<projectname>-1.2.0.0.jar
Design principles
- travis.sh file should not hold any project-specific configuration (should be the same in every repo)
JFrog Artifactory configuration
Common Maven configuration this means:
- Snapshots are uploaded to "libs-snaptshots-local" and releases to "libs-release-local"
- There are two virutal repositories libs-snapshots that includes libs-snapshots-loca and libs-release that includes libs-release-local
- Remote repositories are deleted (as we don't want to be a proxy for Maven Central)
- A user travis-ci has been configured who has rights to upload artifacts
- Anonymous access has been enabled