Gradle替代mvn安装 [英] Gradle alternate to mvn install

查看:138
本文介绍了Gradle替代mvn安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个不同的项目建立在mvn上。



项目1是SDK,项目2是使用sdk(示例)

<在maven的时候,它使用mvn install来创建工件,它将整个项目添加到本地资源库中。



我喜欢像这样在gradle中工作。我喜欢项目1 build.gradle需要将其作为gradle本地存储库发布,然后示例项目需要使用它。

在maven中,我们进行mvn安装,它将项目工件添加到.m2文件夹中,但是如何在gradle中执行,以便我可以将项目artefact添加到本地存储库中。



我可以这样做吗?

解决方案

sdk / build.gradle: $ b

  apply plugin:maven

group =foo
version =1.0

example / build.gradle:

 存储库{
mavenLocal )
}

依赖关系{
编译foo:sdk:1.0
}

$ sdk> gradle install

$ example> gradle build

I have 2 different project build on mvn. I am trying to replace to Gradle.

project 1 is SDK and project 2 is uses the sdk (example)

In the time of maven it creates artifact using mvn install which adds the whole project into local repository.

I like to work in gradle like that. I like project 1 build.gradle need to post it as a gradle local repository and then example project need to use it.

In maven we do mvn install which adds a project artifact into .m2 folder but how to do in gradle so what i can add a project artefact's into the local repository.

Any way that i can do so ?

解决方案

sdk/build.gradle:

apply plugin: "maven"

group = "foo"
version = "1.0"

example/build.gradle:

repositories {
    mavenLocal()
}

dependencies {
    compile "foo:sdk:1.0"
}

$sdk> gradle install

$example> gradle build

这篇关于Gradle替代mvn安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆