mvn clean install causes changes

After running mvn clean install, changes do appear as https://snipboard.io/aJZ1cT.jpg Some Java 9, 10, 11, 12 files are added. Should i commit them? I need some advise regarding this. @sacull, @jwnasambu, @herbert24

I can’t see it. I can see that you are updating files to OpenMRS 1.9, 1.10, 1.11 and 1.12. Unless you mean something else?

Thanks @sacull. They are appearing as changes not staged for commit after running mvn. Do i have to add them and commit them before i make my changes on the ticket? My working tree is not clean.

Sorry, but I don’t understand the question. If you are changing a file and want it to be PR included, you need to push it to a remote repo. To be able to push changes, you need to add and commit beforehand.

Well! basing on the logs you have shared, those files appears to be among the changes you made and therefore you are free to add them for commit by running git add <filename> but if you didn’t make changes on those files , the is a likelihood they are appearing as a result of undoing a commit which pulled all the changes made prior and for that case I will recommend you pull the most recent changes from the upstream branch by running the following commands

  1. git pull --rebase upstream master
  2. git push --force-with-lease origin master

@gracebish try using git reset - - hard

I tried all the above measures but once i run mvn clean install, the files are created once again. These files are created by the command. They are not my local changes, that’s why i was asking what exactly i should do.

what happens when you pull the latest changes ie git pull - - rebase upstream master

I cannot pull rebase with unstaged changes.

do git reset - - hard and then pull the latest changes

This works but once you run mvn clean install which must be run before committing code, these files do appear once again.

Which branch are you on? After updating the master branch ensure you update the local branch too.

Can we have a call on this link https://www.uberconference.com/room/openmrs please!

1 Like

So the purpose of running mvn clean install is (among other things) to allow the automatic code formatter to format code according to the OpenMRS conventions. That’s probably why those files are modified by that process, and we should likely commit those changes to the main repo eventually.

The rule here would be: if you modified those files as part of your commit and then the formatter changed them, then definitely include those changes in your PR. If you didn’t modify those files as part of your commit, than leave them out of that PR and create a separate PR just for the formatting changes.

3 Likes

Thanks @ibacher