This is a proprietary artifact made by Modyo.
It consists of a group of reusable functionalities which the Spring Boot microservices made by the company need for different purposes, such as:
- Utils
- Error Handling
- Logging
- Deployment
- Security
The functionalities are decoupled in three Spring Boot dependencies:
core
http
aws-api-gw
- AdoptOpenJDK11 installed
- Github personal access token environment variables:
GITHUB_USERNAME
: Github usernameGITHUB_TOKEN
: Github access token with at least the scoperead:packages
and Modyo SSO enabled.
If you don't have these credentials, follow the next step instruction, otherwise go to Installation Section.
- Follow the instruction of this link.
- Save the value of the token since it will not be possible to rescue it later.
- Don't forget to include the scope
read:packages
. - Once created, go to the list of tokens, click on Enable SSO and then on Authorize.
- Declare the above environment variables .
In your microservice, go to the build.gradle
and add the next maven repository configuration in the respositories
section:
repositories {
// ... another repositories
maven {
name = 'GitHubPackages'
url = 'https://maven.pkg.github.com/modyo/maven-packages'
credentials {
username = System.getenv("GITHUB_USERNAME")
password = System.getenv("GITHUB_TOKEN")
}
}
}
Then, you can add the dependencies in the dependencies
section:
dependencies {
// ... another dependencies
implementation 'com.modyo.ms.commons:core:2.x.y-RELEASE'
implementation 'com.modyo.ms.commons:http:2.x.y-RELEASE'
implementation 'com.modyo.ms.commons:aws-api-gateway:2.x.y-RELEASE'
}
Add some or all of these dependencies according to your needs.
Finally, in your main application class, add the following annotation:
@ComponentScan({
"com.modyo.ms.commons",
// current application base package
// ... base package of another Spring Boot dependencies
})
public class Application {
// ....
}
If you want to modify any of the dependencies in this project, follow the next steps:
- Clone the
master
branch. - Create new branch with this format:
<feature/fix>/<Jira task code>-short-description
. (Example:feature/SERVICES-123-new-awesome-feature
). - Go to the folder according to the package you want to modify and open it with your IDE.
- Write your code...
- Level up the version in the
build.gradle
folder according to the level of the changes.- Minor: for new features.
- Patch: for modifications in features created previously.
- Test the code typing in your terminal:
./gradlew build
. - Install the package in your local maven repository typing:
./gradlew publishSnapshotPublicationToMavenLocal
. - Use another Spring Boot microservice project to test if the package installation occurs correctly.
To do this, add the maven local repository in the
build.gradle
microservice project file:
repositories {
// ... another repositories
mavenLocal()
}
Then, add the dependency to test in the dependencies
section:
dependencies {
// ... another dependencies
implementation 'com.modyo.ms.commons:<dependency-to-test>:2.x.y-SNAPSHOT'
}
Finally, add the annotation described in the Installation section in your main application class.
- When everything works fine, go back to the dependency code and create a pull request that points to
master
branch. - If the pull request is approved, merge it and create a new release with a new version tag (example:
v2.x.y
) andmaster
branch. - In your computer, checkout to
master
branch and update it. - Publish the new version typing:
./gradlew publishReleasePublicationToGitHubPackagesRepository
.