Because the company project needs to use the company’s internal Maven resources, it is not required at home, so it is time-consuming to switch settings back and forth. To achieve automation, consider making a script to switch sources.
Scripting - Preliminary Scheme
I saw an article on the Internet - script switching, which gave me inspiration. Paste the script here.
1 |
|
As above, you can implement interactive script execution to switch. But this solution still needs to execute the script every time.
Is there a way to do one-click switching? Yes! Alfred can.
Create Alfred Workflow-Advanced Solution
How?
Add input keyword
Add list filter
Add script execution
For the above script, make the following improvements.
1 | base_dir=~/.m2 |
mvn setting default configuration
Here is the maven default settings.xml configuration
Add notification
In order to improve the experience, each time the switch is successful, you will be notified.
Final effect
So we can switch Maven settings with one click now. Perfect.