gradle 调用 java_在gradle脚本中调用java函数(call java function in gradle script)

I have a java class which does some kind of functionality, one of these function returns something that I need to use it into gradle script to set the project properties.

I had achieved it by creating an artifact of project and used that artifact by adding it into classpath, that gave me accessibility of that class and function.

buildscript {

repositories {

jcenter()

maven{

url 'http:localhost:8081/artifactory/temp'

}

}

dependencies {

classpath "utility:sampleutility:1.0"

}

}

import com.polsys.utility.MyUtil

dependencies {

compile 'org.slf4j:slf4j-api:1.7.13'

compile 'HRP:'+new MyUtil().callMe()+':1.0'

//callme function returns the name of artifact.

testCompile 'junit:junit:4.12'

}

Now, I had achieved it by the way as mentioned above that is by creating artifact, add that artifact into classpath, then import classes and use function. Is this any way by which I can call functions of current project? so I can merge that functionality which is available in the artifact into current project.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值