Hi,
I am doing a POC to convert an Ant build to Gradle and I went through the Migration Guide. I’m unable to find the Gradle equivalent for the following Ant references. Here’s the sample Ant build.xml I’m looking to convert.
This is a community forum.
Users like me help other users like you.
You cannot expect any timely answer in this forum.
Especially as it is totally unclear - at least to me - what that Ant snippet is supposed to do. Also because the declared classpath is not even used anywhere.
It is also often not possible or does not make much sense to try to translate an Ant build 1:1 to Gradle. Because the concepts are majorly different. In Ant you configure exactly what to do. In Gradle you configure what you want. This can often not simply be translated and often also shouldn’t.
For example you can surely configure Gradle to put the compiled class files besides the source files like you do in that Ant snippet, but you really shouldn’t do that. Imho you shouldn’t have done it in Ant either, but there it is less of a problem.
My bad, Björn Kautler. I checked the description of the Help/Discuss category which mentions seeking clarification on how something should be done, so I assumed this forum is regularly checked by Gradle Core Developers along with the users.
I understand some of the Ant references in the snippet I provided are old since it’s part of a legacy project. My intention is to identify the Gradle mappings or similar functionality for the corresponding Ant references. I’m trying to create a Gradle build which is close to the Ant build. I understand an exact replication would not be feasible. I was unable to find the references in the migration guide, maybe you can direct me to the right place for this question?
so I assumed this forum is regularly checked by Gradle Core Developers along with the users.
Occasionally they do, but especially in theses times where the Gradle team is pretty short on resources, I don’t think there are many checking in here.
maybe you can direct me to the right place for this question?
The place where you ask is fine.
Or you could ask on StackOverflow for example.
But either way, the problem is, that your question must be clear and you need to find someone able to answer.
My intention is to identify the Gradle mappings or similar functionality for the corresponding Ant references.
Well, as I said very hard to give a mapping, as it most probably does not make any sense at all to map it or to do it like that.
For the <path> you could probably just use a files(...).
For the odir target, you would register a task of type JavaCompile.
But really, you shouldn’t even try to make a Gradle build that is “close to the Ant build”.
Better look at the end result you want to achieve, and then search for an appropriate way to achieve that in Gradle.