# mvn clean install causes changes

**URL:** <https://talk.openmrs.org/t/mvn-clean-install-causes-changes/30775>\
**Category:** Uncategorized\
**Created:** [October 31, 2020, 6:52pm UTC](https://talk.openmrs.org/t/mvn-clean-install-causes-changes/30775 "2020-10-31T18:52:06Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![gracebish](https://talk.openmrs.org/user_avatar/talk.openmrs.org/gracebish/32/13547_2.png) [@gracebish](https://talk.openmrs.org/u/gracebish)\
**Post date:** [October 31, 2020, 6:52pm UTC](https://talk.openmrs.org/t/mvn-clean-install-causes-changes/30775/1 "2020-10-31T18:52:07Z")

</div>

After running mvn clean install, changes do appear as [https://snipboard.io/aJZ1cT.jpg](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

---

<div class="post-metadata">

**Author:** ![sacull](https://talk.openmrs.org/user_avatar/talk.openmrs.org/sacull/32/12430_2.png) [@sacull](https://talk.openmrs.org/u/sacull)\
**Post date:** [November 1, 2020, 7:56am UTC](https://talk.openmrs.org/t/mvn-clean-install-causes-changes/30775/2 "2020-11-01T07:56:51Z")

</div>

> [@gracebish](#):
>
> Some Java 9, 10, 11, 12 files are added.

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?

---

<div class="post-metadata">

**Author:** ![gracebish](https://talk.openmrs.org/user_avatar/talk.openmrs.org/gracebish/32/13547_2.png) [@gracebish](https://talk.openmrs.org/u/gracebish)\
**Post date:** [November 1, 2020, 8:54am UTC](https://talk.openmrs.org/t/mvn-clean-install-causes-changes/30775/3 "2020-11-01T08:54:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sacull](https://talk.openmrs.org/user_avatar/talk.openmrs.org/sacull/32/12430_2.png) [@sacull](https://talk.openmrs.org/u/sacull)\
**Post date:** [November 1, 2020, 9:42am UTC](https://talk.openmrs.org/t/mvn-clean-install-causes-changes/30775/4 "2020-11-01T09:42:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jwnasambu](https://talk.openmrs.org/user_avatar/talk.openmrs.org/jwnasambu/32/13543_2.png) [@jwnasambu](https://talk.openmrs.org/u/jwnasambu)\
**Post date:** [November 1, 2020, 5:24pm UTC](https://talk.openmrs.org/t/mvn-clean-install-causes-changes/30775/5 "2020-11-01T17:24:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![herbert24](https://talk.openmrs.org/user_avatar/talk.openmrs.org/herbert24/32/8178_2.png) [@herbert24](https://talk.openmrs.org/u/herbert24)\
**Post date:** [November 2, 2020, 9:02am UTC](https://talk.openmrs.org/t/mvn-clean-install-causes-changes/30775/6 "2020-11-02T09:02:42Z")

</div>

@gracebish try using git reset - - hard

---

<div class="post-metadata">

**Author:** ![gracebish](https://talk.openmrs.org/user_avatar/talk.openmrs.org/gracebish/32/13547_2.png) [@gracebish](https://talk.openmrs.org/u/gracebish)\
**Post date:** [November 2, 2020, 9:05am UTC](https://talk.openmrs.org/t/mvn-clean-install-causes-changes/30775/7 "2020-11-02T09:05:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![herbert24](https://talk.openmrs.org/user_avatar/talk.openmrs.org/herbert24/32/8178_2.png) [@herbert24](https://talk.openmrs.org/u/herbert24)\
**Post date:** [November 2, 2020, 9:07am UTC](https://talk.openmrs.org/t/mvn-clean-install-causes-changes/30775/8 "2020-11-02T09:07:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gracebish](https://talk.openmrs.org/user_avatar/talk.openmrs.org/gracebish/32/13547_2.png) [@gracebish](https://talk.openmrs.org/u/gracebish)\
**Post date:** [November 2, 2020, 9:10am UTC](https://talk.openmrs.org/t/mvn-clean-install-causes-changes/30775/9 "2020-11-02T09:10:50Z")

</div>

I cannot pull rebase with unstaged changes.

---

<div class="post-metadata">

**Author:** ![herbert24](https://talk.openmrs.org/user_avatar/talk.openmrs.org/herbert24/32/8178_2.png) [@herbert24](https://talk.openmrs.org/u/herbert24)\
**Post date:** [November 2, 2020, 9:11am UTC](https://talk.openmrs.org/t/mvn-clean-install-causes-changes/30775/10 "2020-11-02T09:11:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gracebish](https://talk.openmrs.org/user_avatar/talk.openmrs.org/gracebish/32/13547_2.png) [@gracebish](https://talk.openmrs.org/u/gracebish)\
**Post date:** [November 2, 2020, 10:10am UTC](https://talk.openmrs.org/t/mvn-clean-install-causes-changes/30775/11 "2020-11-02T10:10:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jwnasambu](https://talk.openmrs.org/user_avatar/talk.openmrs.org/jwnasambu/32/13543_2.png) [@jwnasambu](https://talk.openmrs.org/u/jwnasambu)\
**Post date:** [November 2, 2020, 10:41am UTC](https://talk.openmrs.org/t/mvn-clean-install-causes-changes/30775/12 "2020-11-02T10:41:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jwnasambu](https://talk.openmrs.org/user_avatar/talk.openmrs.org/jwnasambu/32/13543_2.png) [@jwnasambu](https://talk.openmrs.org/u/jwnasambu)\
**Post date:** [November 2, 2020, 10:43am UTC](https://talk.openmrs.org/t/mvn-clean-install-causes-changes/30775/13 "2020-11-02T10:43:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ibacher](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ibacher/32/19751_2.png) [@ibacher](https://talk.openmrs.org/u/ibacher)\
**Post date:** [November 2, 2020, 2:42pm UTC](https://talk.openmrs.org/t/mvn-clean-install-causes-changes/30775/14 "2020-11-02T14:42:16Z")

</div>

> [@gracebish](#):
>
> Should i commit them?

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.

---

<div class="post-metadata">

**Author:** ![gracebish](https://talk.openmrs.org/user_avatar/talk.openmrs.org/gracebish/32/13547_2.png) [@gracebish](https://talk.openmrs.org/u/gracebish)\
**Post date:** [November 2, 2020, 2:45pm UTC](https://talk.openmrs.org/t/mvn-clean-install-causes-changes/30775/15 "2020-11-02T14:45:03Z")

</div>

Thanks @ibacher
