"Some files do not have the expected license header" build failure

Hi Everyone,

I am facing error :confused: when building Openmrs-core on windows with the following system environment settings: java version: 1.7.0_71 maven version: 3.2.5

Below is the error message: Failed to execute goal com.mycila:license-maven-plugin:2.6:check (default) on project openmrs-webapp: Some files do not have the expected license header.

Any help/suggestion is greatly appreciated :smiley:

Regards, Manika

1 Like

Which version of OpenMRS-Core are you trying to build? and I don’t know if this should matter but, how are you trying to build - eclipse, intellij, command prompt?

I am trying to build openmrs 1.10.x and using command prompt for the same.

If you are not planning on developing/contributing code to OpenMRS-Core or any other module, I would suggest trying to build and use a released version like 1.10.2 or 1.11.2 (using git checkout). As I believe, the code is changing each moment for .x(1.10.x or 1.11.x and so on) branches having chances of bad code, and in this case there might be some files without license headers and giving the build errors.

2 Likes

Can you please look at the logs are see what are the offending files? That plugin always lists them out, if you have added new files make sure they have the license and should be the new MPL license

2 Likes

@Maurya: Thanks for your suggestion. As I plan to build the module on the OpenMRS platform, I would still need to compile and run the openmrs-core. This would also enable to run the openmrs-webapp on a local server to actually install and manage the modules, if required later.

I would do what @wyclif mentioned as it would help find out which files have the problem.

Secondly, I might have wrongly implied that you had to deploy the war from the downloads. I asked to to git checkout that code and build and deploy them, that way you still can debug and run it in the local.

1 Like

@wyclif: Thank you for your suggestion. I have created new files for the edtriage module using maven archetype and have not added any files to the OpenMRS core. As I am building the module on the OpenMRS platform which is 1.10x (suggested by mentor), I was trying to run openmrs webapp to install the module. The openmrs version in the current pom file is 1.10.3 .

Can you give some details how do I know the problematic files listed by plugin.

Am certainly sure that the module archetype is still generating files with the incorrect header, we need to update it to have the new license. Sorry but you have to manually replace the headers in your java classes to this:

1 Like

Maybe the root problem is that our wiki page with the Eclipse code templates still has the old license: https://wiki.openmrs.org/display/docs/Coding+Conventions

I suggest that:

  • someone updates this to use the new formatter
  • get rid of them as wiki page attachments and move them to github so they can be properly versioned and searchable.

(I don’t use Eclipse anymore so I’m not going to do this since I can’t test it, but it should be a quick fix for someone with Eclipse!)

1 Like

The licenses used by the module archetype are also old as seen at:

I have created this issue to get it updated:

@wyclif, @darius and @maurya: Thank you for providing me with various options in resolving this issue. I am now able to successfully build OpenMRS-core on 1.10.x after updating to the new licence. :smiley:

Regards, Manika

Hi Great to see @manikam that you were able to resolve this issue.

I am trying to build openmrs core 1.12.x using JDK 1.8 and running into the same issue. I just cloned the repository today and got the same error on doing a ‘mvn clean install’. I randomly checked a dozen java files in different packages of openmrs-core but all of them had already implemented the MPL license.

@manikam, could you share some more details on where did you update the license?

Thanks :slight_smile:

1 Like

I had the same problem yesterday building with a JDK7. Trying with JDK8 compilation of openmrs-tools failed because invalid target.

Just to check, doesn’t the failure message report which files are missing the license header?

1 Like

Hi @maany. As mentioned in the previous replies by other developers, there are changes happening to the openmrs-core code base. Please try to clone openmrs-core or pull the latest changes and additionally, you may also check the jdk version to see if it is compatible with the openmrs branch you are trying to build. This might help to get the license for the files.

If it helps, I created a wiki page providing a recipe for how I converted openmrs-core to Mozilla Public License 2.0 with Health Disclaimer (MPL 2.0 HD) and standardize line endings:

Converting code license to MPL 2.0 with Healthcare Disclaimer

Hi @burke there seems to be some kind of permission issue for accessing the link you provided. Can you make the page public.

I have fixed the view restriction that had been inadvertently placed on a parent page.

2 Likes

Just a heads up. The issue still hasn’t been fixed and I’m facing the exact same issue in 1.10.x. The license header one. I reset back to commits in February and they seemed to work I believe. So if anyone is looking to work on this branch, you might want to consider doing the same :slightly_smiling: