How to execute maven plugins from gradle without having maven and java installed

后端 未结 3 1011
感动是毒
感动是毒 2021-01-20 20:11

I need to execute a maven plugin on a system that does not have both maven and java installed and installing both of them on the syste

相关标签:
3条回答
  • 2021-01-20 20:34

    Java is required for Maven and for Gradle too.

    You can use Maven Wrapper exactly like with Gradle.

    Execute this command in project directory (this creates executable script like in gradle)

    mvn -N io.takari:maven:wrapper
    

    To invoke this project without maven installed use:

    ./mvnw GOAL
    
    0 讨论(0)
  • 2021-01-20 20:42

    Both Maven and Gradle require java to be installed. See https://docs.gradle.org/current/userguide/installation.html

    0 讨论(0)
  • 2021-01-20 20:52

    Gradle is a build system. You can build anything with it, including native binaries.

    And yes, you can call Maven Plugins from Gradle, as Maven Plugins are written in Java and Gradle is based on Groovy and thus on Java.

    But both facts have nothing to do with each other.

    You can of course also use Gradle (or any other build system including manually stuffing things together) to build a distributable that includes a Java runtime environment. But then Java is, as said, shipped with your result. You cannot run Java code without having Java around, besides porting the Java code to something else like C++ that compiles to a native binary.

    Yes, you can also call Java code from native code if you do some glueing, but no, also this will not work without having Java around, because that's the way Java works.

    0 讨论(0)
提交回复
热议问题