ooomid
ooomid

Reputation: 223

How can I add additional dependencies for my maven project without committing it to pom.xml file?

I want to add a dependency for example Spring Developer Tools. I understand that I can add it to the pom.xml file, but that'll make git show the addition as an uncommitted change. I don't want to commit this, it'll be just for my local testing.

Is there a way I can have a secondary pom.xml file for this dependency and then I can add that to .git/info/exclude so that it can be ignored?

Upvotes: 0

Views: 193

Answers (1)

Tristate
Tristate

Reputation: 1831

do a new git branch and put your changes there for testing. Example

git checkout -b "feature/playground"

Modify your pom, than you can apply your changes to your testing branch.

git add -u
git commit -m "Devtools added"

if you need to go back to your unchanged branch.

git checkout master

if master is your main branch.

This is by far best solution. If you for some un clearly reasons want avoid of pushing devtools into your master branch.

But to answer you Question directly. Depend on your IDE, you can add a Dependencie without to change your pom. For that you need to download the .jar you want to add.

And than add it via UI of your IDE. Here is an example how it looks like in JetBrains IntelliJ IDEA

enter image description here

Upvotes: 1

Related Questions