Hola
Hola

Reputation: 125

Convert maven to gradle?

I have a project in maven. I want to convert project to gradle project how convert this code maven to code gradle:

    <build>
        <plugins>
            <plugin>
                <groupId>com.google.cloud.functions</groupId>
                <artifactId>function-maven-plugin</artifactId>
                <version>0.9.1</version>
                <configuration>
                    <functionTarget>org.springframework.cloud.function.adapter.gcp.GcfJarLauncher</functionTarget>
                    <port>8080</port>
                </configuration>
            </plugin>
        </plugins>
    </build>

Upvotes: 0

Views: 1734

Answers (2)

Mark Bramnik
Mark Bramnik

Reputation: 42541

I've never used function framework, however when it comes to plugin translation, these are pieces of code usually written by the maintainers of the framework, and usually they want to provide plugins for both maven and gradle.

Indeed in the documentation of the project, there is section for maven:

See Here

And also for gradle:

See Here

It looks like they offer to register the task in gradle, so its the best you can do with the existing state of the project, so its the way to go I believe

Upvotes: 0

user16797929
user16797929

Reputation:

First install Gradle on your machine.

Now, go to your maven project’s root directory and execute command:

gradle init

Please note that gradle init automatically detects the pom.xml and creates a gradle build with the Java and maven plugin loaded. It means that existing Maven dependencies are automatically converted and added to your gradle build file.

So that the build.gradle file will be automatically created thanks to the gradle init command.And now your project is using gradle

Upvotes: 2

Related Questions