Issue
I've a multi-module maven-java project stored in a git repository. We need to make a release for this project and to do so I've made my corresponding commits. After that, I've create a tag called my-project-1.0.0.2.
git tag -a my-project-1.0.0.2 -m "my version 1.0.0.2"
Then pushed this to the remote with the following
git push origin --tags
Now the problem is the following:
In my default project location, I switch to new branch using this tag release, compile it using "mvn clean install" and a jar file with the setup.exe is created after some build process. It is about 90mb. I run the setup.exe, everything works fine.
Later, I wanted to test that if the tag release commit is correctly created, and created another folder in some other directory. Checked out the same git project, and switch to this tag. I go through the same build process using "mvn clean install" however when the jar file and the setup.exe are created, this time they are about 70mb. Because of this, the application doesn't behave correctly.
If I knew that the very tagged commit is defected, why it works in my main project folder when i checkout this tag, but the very same tagged version doesn't work correctly when i try to build the project in another location.
For any hint, thanks in advance!
Solution
Missing source files?
Do you maybe have any uncommitted changes in your default repository location? (With "smart checkouts" Git can keep track of your local, uncomitted changes and automatically apply it also to new branches when switching them. This will apply for "old" repositories only and not for new ones. Therefore this behaviour might lead to strange, unexpected behaviour from time to time.) Also note "Git is only keeping track of files" so in case you've empty folders your project depends on during the build, they will be present in your default location, but not on your second one!
A fast way to check for missing files is to create a diff of your two repositories with a tool like KDiff3.
Special project setup
The second issue could be a missed project setup for one of your repositories/ workspaces. Often special, one-time only setups are performed, when creating the workspace for the first time.
This later can be easily forgotten, so that special tasks or configuration do not apply to the new workspaces, but automatically for older ones. Is there any other special project setup in your default location like a special, default profile being automatically applied to your mvn build, which leads to a problematic build when not applied in your new workspaces?
After clarification in the comments it turned out that some jar files needed for the build were missed by being erroneously excluded in the .gitignore
file.
Answered By - Sebsen36