Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to modify build.gradle file programmatically?

Is there any way to add dependency to a gradle or maven project programmatically ? I am trying to modify a java file using eclipse JDT. One of my changes requires a method from apache-commons. So I have to check programmatically whether the library is already included and if not I have to add the dependency. Is there any way or tool that helps me?

like image 286
aravindkanna Avatar asked Nov 27 '25 22:11

aravindkanna


1 Answers

You should not modify build file, like pom.xml or build.gradle for that needs. I think, it's a better idea to check if the library is in the project's classpath and if it's not - gently ask a developer to add it. That's how, for example, generating of toString works in IDEA: if certain libraries are available in the project corresponding options become available: <code>toString()</code> options

like image 103
madhead - StandWithUkraine Avatar answered Nov 29 '25 11:11

madhead - StandWithUkraine



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!