maven project as dependency in gradle project

前端 未结 2 553
盖世英雄少女心
盖世英雄少女心 2020-12-30 23:05

I have a project which is using Gradle as build tool and a second subproject which is using Maven\'s POM. I don\'t have the freedom of changing build tool on the subproject.

2条回答
  •  囚心锁ツ
    2020-12-30 23:43

    You cannot "include" a maven project in gradle settings.gradle. The simplest way would be to build the maven project and install it to your local repo using mvn install(can be default .m2, or any other custom location) and then consume it from your gradle project using groupname:modulename:version

    repositories{
        mavenLocal()
    }
    
    dependencies{
        compile 'vendor:otherproj:version'
    }
    

    It is possible to depend directly on the jar of the maven project using compile files but this isn't ideal because it wont fetch transitive dependencies and you'll have to add those manually yourself.

提交回复
热议问题