Have you implemented OpenMRS? Please participate in the Implementation Site Survey. If you already have, thank you!
So, you have some code (e.g., a module) that you want to convert to use the standard OpenMRS licensing (MPL 2.0 with Healthcare Disclaimer). We are using the License Maven Pluginto manage license headers within code. See the pom.xml in openmrs-corefor an example of how this plugin is configured within the main project pom.xml.
Before converting the license for a repository, be certain that you have the authority to change the license. Changing the license of your own work or changing the license for a repository owned & managed by the OpenMRS community should not be an issue, but if you are using a repository forked from a third party, you may not have the authority to simply re-license their code without their permission.
This recipe assumes
This recipe will also convert all of your line endings to LF (line feed) to follow the OpenMRS conventions of storing LF in github and letting git convert line feeds magically based on the client.
sudo apt-get install dos2unix)
Convert line endings to line feeds. You can use dos2unix on your entire repository. Alternatively, if you have Java and Groovy installed in your environment, you can use the attached scan-newlines groovy script (download & make executable with
chmod +x scan-newlines):
Assuming you have Java & Groovy installed, scan files for non-OpenMRS licenses using the attached scan-licenses groovy script (download, make executable with
chmod +x scan-licenses):
If you don't have Groovy installed, then you should scan the files in your repository manually and/or using git to check for any code that is already separately licensed. For example, the following grep command will look for files containing any references to the old "OpenMRS Public License":
It is critical that these files be excluded from the licensing plugin so the proper licenses are not illegally overwritten with an OpenMRS license. You can see examples of exceptions in the openmrs-core pom.xml directive for the maven license plugin.
Once you have updated your pom.xml to use the maven license plugin and have excluded any files or folders that contain separately licensed code, you can use a maven directive to apply the MPL 2.0 HD license header to your code:
mvn license:format without excluding files under separate licenses or converting to line feed (LF) line endings could inappropriate (even illegally) overwrite existing non-OpenMRS licenses or have unpredictable results. When you are first converting a repository's license, we highly recommend first making a copy of your local copy so you can easily recover if something goes wrong.
Confirm that your local copy still builds and passes all tests. If it does, then you are ready to commit changes:
Once a repository has been converted over to using the maven license plugin, you can easily check and update licenses.