Reputation: 2090
I cannot run my application on my machine unless I add a dependency. Since this is only a hotfix, I do not want to add the dependency on the git repo.
I would like a way to add a temporary dependency, without having to edit the pom.xml everytime I git pull/push.
Upvotes: 0
Views: 185
Reputation: 594
You can achieve this by using maven profiles. Just put the dependency that is required only for hotfix on the profile named hotfix and put other dependencies without any profile.
<profiles>
<profile>
<id>hotfix</id>
…
<dependencies>
<dependency>…</dependency>
</dependencies>
…
</profile>
</profiles>
<dependencies>
<dependency>...</dependency>
</dependencies>
To activate the profile supply profile name with -P option on any maven command. For example, to activate hotfix profile while doing clean and install use command mvn clean install -Photfix
Also, there are other ways to activate maven profiles. Please see link for more information: https://maven.apache.org/guides/introduction/introduction-to-profiles.html
Upvotes: 1