{"id":36418428,"url":"https://github.com/steinarb/liquibase-karaf-feature","last_synced_at":"2026-01-11T17:01:27.471Z","repository":{"id":52279240,"uuid":"93083271","full_name":"steinarb/liquibase-karaf-feature","owner":"steinarb","description":"An apache karaf feature for the liquibase RDMBS schema management, including slf4j logging.","archived":false,"fork":false,"pushed_at":"2026-01-10T20:14:04.000Z","size":423,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-01-11T03:39:33.122Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/steinarb.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-06-01T17:36:35.000Z","updated_at":"2026-01-10T20:14:07.000Z","dependencies_parsed_at":"2023-02-18T00:31:07.999Z","dependency_job_id":"6dbf32a5-68b6-47f6-ada2-cd293f197cab","html_url":"https://github.com/steinarb/liquibase-karaf-feature","commit_stats":{"total_commits":145,"total_committers":3,"mean_commits":"48.333333333333336","dds":0.01379310344827589,"last_synced_commit":"f3041cd39eab92afcf2e45a3fc6a9365a6e1d208"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/steinarb/liquibase-karaf-feature","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steinarb%2Fliquibase-karaf-feature","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steinarb%2Fliquibase-karaf-feature/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steinarb%2Fliquibase-karaf-feature/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steinarb%2Fliquibase-karaf-feature/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/steinarb","download_url":"https://codeload.github.com/steinarb/liquibase-karaf-feature/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steinarb%2Fliquibase-karaf-feature/sbom","scorecard":{"id":113475,"data":{"date":"2025-08-04","repo":{"name":"github.com/steinarb/liquibase-karaf-feature","commit":"c262ab1ec48781d1e74244e7b61a11903a4ffdc3"},"scorecard":{"version":"v5.2.1-28-gc1d103a9","commit":"c1d103a9bb9f635ec7260bf9aa0699466fa4be0e"},"score":4.3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/7 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/liquibase-karaf-feature-maven-ci-build.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#token-permissions"}},{"name":"Maintained","score":10,"reason":"30 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/liquibase-karaf-feature-maven-ci-build.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/steinarb/liquibase-karaf-feature/liquibase-karaf-feature-maven-ci-build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/liquibase-karaf-feature-maven-ci-build.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/steinarb/liquibase-karaf-feature/liquibase-karaf-feature-maven-ci-build.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 23 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-j288-q9x7-2f5v"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-15T18:39:05.283Z","repository_id":52279240,"created_at":"2025-08-15T18:39:05.283Z","updated_at":"2025-08-15T18:39:05.283Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28314259,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T14:58:17.114Z","status":"ssl_error","status_checked_at":"2026-01-11T14:55:53.580Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-11T17:01:17.026Z","updated_at":"2026-01-11T17:01:27.460Z","avatar_url":"https://github.com/steinarb.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"* A Karaf feature for liquibase-core\n\n/NOTE! Version 4.15.0 is the first release of the liquibase karaf feature in nearly three years/ See [[Using liquibase from OSGi bundles]] if you come from version 3.8.0 of this feature, for changes that need to be made.\n\nThis project contains a [[https://karaf.apache.org/manual/latest/provisioning][karaf feature]] for easily using [[https://en.wikipedia.org/wiki/Liquibase][Liquibase]] from OSGi-based applications running in [[http://karaf.apache.org][apache karaf]].\n\nIf you haven't yet encountered it: liquibase is a really smooth solution for handling your RDBMS schemas.  Smooth initial startup, and smooth evolution of schemas (adding columns, adding tables, dropping columns and dropping tables).\n\nLiquibase does the same job as ad-hoc delta script solutions, but liquibase does the job in a clean and robust way, tested and refined over the 11 years of its existence.\n\nLiquibase does pretty much the same thing as [[https://flywaydb.org][flyway]] but in a different way that fits my programmer's mind better. And liquibase is cross-database capable, i.e. done right it's possible to write schema migrations in ways that will make them work on all databases with a JDBC driver.\n\n** Project status\n[[https://maven-badges.herokuapp.com/maven-central/no.priv.bang.karaf/liquibase-core-karaf][file:https://maven-badges.herokuapp.com/maven-central/no.priv.bang.karaf/liquibase-core-karaf/badge.svg]]\n[[https://github.com/steinarb/liquibase-karaf-feature/actions/workflows/liquibase-karaf-feature-maven-ci-build.yml][file:https://github.com/steinarb/liquibase-karaf-feature/actions/workflows/liquibase-karaf-feature-maven-ci-build.yml/badge.svg]]\n\n*** Release history\n\n| Date                   |  Version | Liquibase version | Liquibase slf4j version | Comment                                                      |\n|------------------------+----------+-------------------+-------------------------+--------------------------------------------------------------|\n| \u003c2025-07-09 Wed 23:22\u003e |   4.33.0 |            4.33.0 |                         |                                                              |\n| \u003c2025-04-05 Sat 15:53\u003e |   4.31.1 |            4.31.1 |                         |                                                              |\n| \u003c2025-02-19 Wed 17:23\u003e |   4.31.0 |            4.31.0 |                         | From karaf 4.4.7 uses karaf spifly feature to load SPIfly    |\n| \u003c2024-12-10 Tue 20:31\u003e |   4.30.0 |            4.30.0 |                         |                                                              |\n| \u003c2024-07-31 Wed 18:13\u003e |   4.29.0 |            4.29.0 |                         |                                                              |\n| \u003c2024-07-03 Wed 22:07\u003e | 4.28.0.1 |            4.28.0 |                         | Bugfix for 4.28.0 release                                    |\n| \u003c2024-07-03 Wed 21:33\u003e |   4.28.0 |            4.28.0 |                         | Adds new liquibase-runner library                            |\n| \u003c2024-04-05 Fri 22:27\u003e |   4.27.0 |            4.27.0 |                         |                                                              |\n| \u003c2023-12-11 Mon 22:33\u003e |   4.24.0 |            4.24.0 |                         |                                                              |\n| \u003c2023-12-12 Tue 22:33\u003e |   4.23.2 |            4.23.2 |                         |                                                              |\n| \u003c2023-12-11 Mon 21:07\u003e |   4.25.0 |            4.23.1 |                         | Mistaken release! Sorry!                                     |\n| \u003c2023-12-11 Mon 20:44\u003e |   4.23.1 |            4.23.1 |                         | Integration test had to replace derby with h2                |\n| \u003c2023-06-28 Wed 23:53\u003e |   4.23.0 |            4.23.0 |                         | First OSGi compatible version since 4.19.0                   |\n| \u003c2023-03-05 Sun 21:10\u003e |   4.19.0 |            4.19.0 |                         |                                                              |\n| \u003c2022-10-30 Sun 15:48\u003e |   4.17.1 |            4.17.1 |                         |                                                              |\n| \u003c2022-08-20 Sat 19:27\u003e |   4.15.0 |            4.15.0 |                         | First liquibase 4.x release of the feature                   |\n| \u003c2019-11-18 Mon 21:25\u003e |    3.8.0 |             3.8.0 |                   2.0.0 |                                                              |\n| \u003c2019-11-18 Mon 20:42\u003e |    3.7.0 |             3.7.0 |                   2.0.0 | Use snakeyaml 1.23                                           |\n| \u003c2019-11-18 Mon 19:33\u003e |    3.6.3 |             3.6.3 |                   2.0.0 |                                                              |\n| \u003c2019-11-17 Sun 22:58\u003e |    3.6.2 |             3.6.2 |                   2.0.0 |                                                              |\n| \u003c2019-11-17 Sun 22:09\u003e |  3.6.1.1 |             3.6.1 |                   2.0.0 | Loads snakeyaml 1.18 instead of 1.17                         |\n| \u003c2019-11-17 Sun 17:35\u003e |    3.6.1 |             3.6.1 |                   2.0.0 | Broken because of wrong snakeyaml version                    |\n| \u003c2019-11-17 Sun 21:27\u003e |  3.6.0.1 |             3.6.0 |                   2.0.0 | Loads snakeyaml 1.18 instead of 1.17                         |\n| \u003c2019-11-17 Sun 16:01\u003e |    3.6.0 |             3.6.0 |                   2.0.0 | Broken because of wrong snakeyaml version                    |\n| \u003c2019-11-16 Sat 23:09\u003e |    3.5.5 |             3.5.5 |                   2.0.0 | Use version 3.5.1 of maven-bundle-plugin                     |\n| \u003c2019-11-16 Sat 11:28\u003e |    3.5.4 |             3.5.4 |                   2.0.0 | Updated pom.xml release config, update karaf to 4.2.7        |\n| \u003c2017-08-06 Sun 18:48\u003e |    3.5.3 |             3.5.3 |                   2.0.0 | First release with the same version as the liquibase version |\n| \u003c2017-08-06 Sun 15:18\u003e |    1.0.2 |             3.5.3 |                   2.0.0 | First successful release                                     |\n| \u003c2017-08-06 Sun 12:03\u003e |    1.0.1 |             3.5.3 |                   2.0.0 | Failed release                                               |\n| \u003c2017-08-05 Sat 21:37\u003e |    1.0.0 |             3.5.3 |                   2.0.0 | Failed release                                               |\n** Installing the liquibase feature in karaf\n\nTo install this feature:\n 1. start karaf and give the following commands to the karaf console:\n    #+BEGIN_EXAMPLE\n      feature:repo-add mvn:no.priv.bang.karaf/liquibase-core-karaf/4.33.0/xml/features\n      feature:install liquibase-core\n    #+END_EXAMPLE\n\nAfter this, [[http://www.liquibase.org/javadoc/liquibase/Liquibase.html][the liquibase Java API]] is available to your OSGi applications and the liquibase logging will go to the karaf log.\n\n** Using liquibase from a karaf feature\nTo use liquibase from your own, manually edited, karaf feature, include the feature's feature repository and depend on the liquibase-core feature:\n#+BEGIN_SRC xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?\u003e\n\u003cfeatures xmlns=\"http://karaf.apache.org/xmlns/features/v1.4.0\" name=\"ukelonn.bundle.db.liquibase\"\u003e\n    \u003crepository\u003emvn:no.priv.bang.karaf/liquibase-core-karaf/4.33.0/xml/features\u003c/repository\u003e\n    \u003cfeature name=\"ukelonn-db-liquibase\"\u003e\n        \u003cfeature\u003eliquibase-core\u003c/feature\u003e\n    \u003c/feature\u003e\n\u003c/features\u003e\n#+END_SRC\n\n** Using liquibase from a generated karaf feature\n\nIf you generate your karaf feature repository using the karaf-maven-plugin, you can include the liquibase-core feature into your generated feature repository, by adding this dependency to the maven project building the feature repository:\n#+BEGIN_SRC xml\n  \u003cdependency\u003e\n      \u003cgroupId\u003eno.priv.bang.karaf\u003c/groupId\u003e\n      \u003cartifactId\u003eliquibase-core-karaf\u003c/artifactId\u003e\n      \u003cversion\u003e4.33.0\u003c/version\u003e\n      \u003ctype\u003exml\u003c/type\u003e\n      \u003cclassifier\u003efeatures\u003c/classifier\u003e\n  \u003c/dependency\u003e\n#+END_SRC\n\n** Building the feature for a different version of Liquibase\nThe version number of this karaf feature is intended to be the same as the Liquibase version it is a feature for.\n\nThis makes it simple for me to roll and release a new version of the feature when a new version of Liquibase is out.\n\nBut unfortunately this means that a SNAPSHOT version of the feature won't be able to refer to a real Liquibase version... at least not without a little edit:\n 1. clone this project:\n    #+BEGIN_EXAMPLE\n      mkdir -p ~/git\n      cd ~/git\n      git clone https://github.com/steinarb/liquibase-karaf-feature/\n    #+END_EXAMPLE\n 2. edit the pom, changing the liquibase.version property\n    #+BEGIN_SRC xml\n      \u003cliquibase.version\u003e${project.version}\u003c/liquibase.version\u003e\n    #+END_SRC\n    change it into an actual version\n    #+BEGIN_SRC xml\n      \u003cliquibase.version\u003e3.5.4\u003c/liquibase.version\u003e\n    #+END_SRC\n 3. then build the project with maven:\n    #+BEGIN_EXAMPLE\n      cd liquibase-karaf-feature\n      mvn clean install\n    #+END_EXAMPLE\n\n*** Test a new version\n\nI have created the project [[https://github.com/steinarb/liquibase-sample#liqubase-sample][liquibase-sample]] to test new versions of this karaf feature.\n\nThe liquibase-sample has a minimal OSGi component that loads and creates a schema in a derby in-memory database from a liquibase changelog file.\n\nThe liquibase-sample application can also be used to verify that the liquibase logs are redirected to the karaf logs.\n\n** Using liquibase from OSGi bundles\n\nLiquibase 4 is built internally with an inversion-of-control architecture, and uses [[[https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/ServiceLoader.html][java.util.ServiceLoader]] to find the implementations of its services.\n\nThe ServiceLoader doesn't work well with OSGi. The ServiceLoader expects a single, flat, classloader, and a single thread, and this is not what OSGi has.\n\nIt is possible to make the ServiceLoader work in OSGi, [[https://blog.osgi.org/2013/02/javautilserviceloader-in-osgi.html][using the Service Loader Mediator]].\n\nA [[https://en.wikipedia.org/wiki/OSGi_Specification_Implementations#Implementations#133:_Service_Loader_Mediator_Specification][single implementation of the service loader mediator exists]]: [[https://aries.apache.org/documentation/modules/spi-fly.html][Apache Aries SPI Fly]].\n\nThe liquibase karaf feature created from this project will load SPI Fly at the same start-level as the liquibase-core bundle.\n\nThe Require-Capability header of OSGi bundle manifests can be used to start available SPI services, and once started they will behave as regular OSGi services.\n\nThe liquibase-core bundle will start all SPI services it requires in the maniest, so you, as a user, don't have to think about SPI or Apache Aries SPI Fly (but it can be helpful to know what's going on).\n\n/Note/! One thing you will need to think about is if you use XML formatted Liquibase change logs: Liquibase will need to find the XSD schema files when parsing the change logs.\n\nThe XSD files are provideded as classpath resources in the liquibase-core OSGi bundle.\n\nBut these resources aren't available to other OSGi bundles (classpath resources are local to the bundle they reside in).\n\nThis means that all OSGi bundles that parse XML liquibase change logs needs to copy the XSD schemas of liquibase-core into its own classpath.\n\nThe \u003cInclude-Resource\u003e of the maven-bundle-plugin config below will copy the XSD schemas into the place where liquibase will look for them.\n\nCopy this config into all OSGi bundles that load liquibase XML change logs.\n\n#+begin_src xml\n  \u003cproject 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\" xml:space=\"preserve\"\u003e\n      \u003cbuild\u003e\n          \u003cplugins\u003e\n              \u003cplugin\u003e\n                  \u003cgroupId\u003eorg.apache.felix\u003c/groupId\u003e\n                  \u003cartifactId\u003emaven-bundle-plugin\u003c/artifactId\u003e\n                  \u003cversion\u003e5.1.9\u003c/version\u003e\n                  \u003cconfiguration\u003e\n                      \u003cinstructions\u003e\n                          \u003cInclude-Resource\u003e\n                              /=target/classes/,\n                              /www.liquibase.org/=target/dependency/www.liquibase.org/\n                          \u003c/Include-Resource\u003e\n                      \u003c/instructions\u003e\n                  \u003c/configuration\u003e\n              \u003c/plugin\u003e\n              \u003cplugin\u003e\n                  \u003cgroupId\u003eorg.apache.maven.plugins\u003c/groupId\u003e\n                  \u003cartifactId\u003emaven-dependency-plugin\u003c/artifactId\u003e\n                  \u003cexecutions\u003e\n                      \u003cexecution\u003e\n                          \u003cid\u003ecopy-liquibase-xsd\u003c/id\u003e\n                          \u003cphase\u003evalidate\u003c/phase\u003e\n                          \u003cgoals\u003e\n                              \u003cgoal\u003eunpack\u003c/goal\u003e\n                          \u003c/goals\u003e\n                          \u003cconfiguration\u003e\n                              \u003cartifactItems\u003e\n                                  \u003cartifactItem\u003e\n                                      \u003cgroupId\u003eorg.liquibase\u003c/groupId\u003e\n                                      \u003cartifactId\u003eliquibase-core\u003c/artifactId\u003e\n                                  \u003c/artifactItem\u003e\n                              \u003c/artifactItems\u003e\n                              \u003cincludes\u003e**/dbchangelog-3.5.xsd\u003c/includes\u003e\n                          \u003c/configuration\u003e\n                      \u003c/execution\u003e\n                  \u003c/executions\u003e\n              \u003c/plugin\u003e\n          \u003c/plugins\u003e\n      \u003c/build\u003e\n  \u003c/project\u003e\n#+end_src\n\nIn the above example only dbchangelog-3.5 is copied. If a different schema version is used, that version must be copied instead.\n\nTo copy all schemas, change includes to this (Disclaimer: not tested):\n#+begin_src xml\n  \u003cincludes\u003e**/*.xsd\u003c/includes\u003e\n#+end_src\n\n** Current problems under OSGi\nApart from the issues worked around in the previous section I see the following problems:\n 1. Starting with liquibase 4.19.1 and fixed in 4.21.0 using liquibase in OSGi failed with the error message\n    #+begin_example\n      java.lang.NullPointerException: Cannot invoke \"liquibase.logging.mdc.MdcManager.put(String, String)\" because the return value of \"liquibase.Scope.getMdcManager()\" is null at liquibase.Scope.addMdcValue(Scope.java:416)\n    #+end_example\n    This was reported as https://github.com/liquibase/liquibase/issues/3910\n 2. Starting with version 4.21.0 the Liquibase facade stopped working for me.  To avoid messages like this:\n    #+begin_example\n      2022-09-10T13:47:54,302 | ERROR | CM Configuration Updater (ManagedServiceFactory Update: factoryPid=[org.ops4j.datasource]) | HandleregProductionDbLiquibaseRunner | 125 - no.priv.bang.handlereg.db.liquibase.production - 1.0.0.SNAPSHOT | Failed to create handlereg derby test database\n      liquibase.exception.LiquibaseException: java.lang.RuntimeException: Cannot end scope cpkebkpkfa when currently at scope bbldyrztji\n              at liquibase.Liquibase.runInScope(Liquibase.java:2419) ~[?:?]\n              at liquibase.Liquibase.update(Liquibase.java:209) ~[?:?]\n              at liquibase.Liquibase.update(Liquibase.java:195) ~[?:?]\n              ...\n    #+end_example\n    the Liquibase facade has to be replaced with ScopeRunner using ThreadLocalScopeManager.\n    I.e. something like this\n    #+begin_src java\n      @Component(immediate=true, property = \"name=sampledb\")\n      public class SampleDbLiquibaseRunner implements PreHook {\n\n          private Bundle bundle;\n\n          @Activate\n          public void activate(BundleContext bundlecontext) {\n              this.bundle = bundlecontext.getBundle();\n          }\n\n          @Override\n          public void prepare(DataSource datasource) throws SQLException {\n              try (Connection connection = datasource.getConnection()) {\n                  applyLiquibaseChangelist(connection, \"sample-db-changelog/db-changelog-1.0.0.xml\");\n              } catch (LiquibaseException e) {\n                  throw new RuntimeException(\"Error creating sampleapp test database schema\", e);\n              }\n          }\n\n          private void applyLiquibaseChangelist(Connection connection, String changelistClasspathResource) throws LiquibaseException {\n              try(Liquibase liquibase = createLiquibaseInstance(connection, changelistClasspathResource)) {\n                  liquibase.update(\"\");\n              }\n          }\n\n          private Liquibase createLiquibaseInstance(Connection connection, String changelistClasspathResource) throws LiquibaseException {\n              DatabaseConnection databaseConnection = new JdbcConnection(connection);\n              var resourceAccessor = new OSGiResourceAccessor(bundle);\n              return new Liquibase(changelistClasspathResource, resourceAccessor, databaseConnection);\n          }\n\n      }\n    #+end_src\n    has to be replaced with something like this:\n    #+begin_src java\n      @Component(immediate=true, property = \"name=sampledb\")\n      public class SampleDbLiquibaseRunner implements PreHook {\n\n          @Activate\n          public void activate(BundleContext bundlecontext) {\n              Scope.setScopeManager(new ThreadLocalScopeManager());\n          }\n\n          @Override\n          public void prepare(DataSource datasource) throws SQLException {\n              try (var connection = datasource.getConnection()) {\n                  applyLiquibaseChangelist(connection, \"sample-db-changelog/db-changelog-1.0.0.xml\");\n              } catch (Exception e) {\n                  throw new RuntimeException(\"Error creating sampleapp test database schema\", e);\n              }\n          }\n\n          private void applyLiquibaseChangelist(Connection connect, String liquibaseChangeLogClassPathResource) throws Exception, DatabaseException {\n              applyLiquibaseChangelist(connect, liquibaseChangeLogClassPathResource, getClass().getClassLoader());\n          }\n\n          public void applyLiquibaseChangelist(Connection connect, String liquibaseChangeLogClassPathResource, ClassLoader classLoader) throws Exception {\n              try (var database = findCorrectDatabaseImplementation(connect)) {\n                  Scope.child(scopeObjectsWithClassPathResourceAccessor(classLoader), () -\u003e new CommandScope(UPDATE)\n                              .addArgumentValue(DATABASE_ARG, database)\n                              .addArgumentValue(CHANGELOG_FILE_ARG, liquibaseChangeLogClassPathResource)\n                              .execute());\n              }\n          }\n\n          private Database findCorrectDatabaseImplementation(Connection connect) throws DatabaseException {\n              return DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(connect));\n          }\n\n          private Map\u003cString, Object\u003e scopeObjectsWithClassPathResourceAccessor(ClassLoader classLoader) {\n              return Map.of(resourceAccessor.name(), new ClassLoaderResourceAccessor(classLoader));\n          }\n\n      }\n    #+end_src\n** Testing and debugging in karaf\nIf the integration test fails in the schema setup, I haven't yet found a way to debug in the integration test itself.\n\nBut it is possible to start a karaf process locally, attach an IDE to that karaf process for remote debugging, and then load the same feature as the integration tests.\n\nThe procedure, is:\n 1. [[https://karaf.apache.org/get-started][Download a tar-ball or zip file from the newest binary release, and unpack it]]\n 2. cd into the unpacked karaf distro, and start karaf in debug mode:\n    #+begin_example\n      ./bin/karaf debug\n    #+end_example\n 3. In the IDE create a remote debug configuration attaching to localhost port 5005 and start the debug configuration\n 4. Also in the IDE, set a breakpoint where you want the debugger to stop (for me it's a point in my own code that occurs in the stack trace I'm trying to debug)\n 5. Load the same karaf feature as the integration test\n    #+begin_example\n      feature:repo-add mvn:no.priv.bang.karaf/karaf.liquibase.sample.datasource.receiver/LATEST/xml/features\n      feature:install karaf-liquibase-sample-datasource-receiver\n    #+end_example\n 6. The IDE will stop on the breakpoint in the debugger and it's possible to step into the release\n 7. If you want to restart:\n    1. Disconnect the debugger\n    2. Stop karaf with Ctrl-D in the console\n    3. delete the data directory in karaf:\n       #+begin_example\n         rm -rf data\n       #+end_example\n    4. Start karaf again in debug mode\n       #+begin_example\n         ./bin/karaf debug\n       #+end_example\n    5. Start a remote debug session from the IDE\n    6. Use arrow up in the karaf console to rerun the feature:repo-add and feature:install commands for the feature\n* License\n\nThis maven project is licensed with the [[https://www.apache.org/licenses/LICENSE-2.0][Apache v 2.0 license]].\n\nThe details of the license can be found in the LICENSE file.\n\nThe  [[https://github.com/mattbertolini/liquibase-slf4j][liquibase-slf4j]] jar is covered with the MIT license, copyright 2012-2015 Matt Bertolini.  This license and copyright also covers the rebundled version of the jar that results from the \"com.mattbertolini.liquibase-slf4j-osgi\" maven module.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteinarb%2Fliquibase-karaf-feature","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsteinarb%2Fliquibase-karaf-feature","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteinarb%2Fliquibase-karaf-feature/lists"}