user840930
user840930

Reputation: 5578

how to convert maven pom.xml into build.gradle file?

I have a maven pom.xml file I need to convert into a build.gradle file. How do I do this? For example, I am defining a resources file in the pom.xml file:

 <resources>
  <resource>
   <directory>src/main/resources/</directory>
        <includes>
            <include>config.properties</include>
        </includes>
    </resource>
   </resources>

Upvotes: 4

Views: 3175

Answers (1)

madhead
madhead

Reputation: 33412

When you do gradle init in a directory with pom.xml it will try to convert some configuration parts automagically for you. Though it's not complete but you'll get the most basic parts converted: multi-module setup, repositories and dependencies.

Generally, src/main/resources is already recognized as "resources" directory by both Maven and Gradle, so you don't need to configure it separately unless the config is not standard. E.g. you can enable filtering by:

<resource>
    <directory>src/main/resources</directory>
    <filtering>true</filtering>
</resource>

In Gradle you'll need to configure processResources (processMainResources) task:

processResources {
    expand project.properties
}

However, it's not the only way and you may find filter more useful.

Upvotes: 3

Related Questions