I have a project (Main project with sub projects) structure
ProjectMain
build.gradle
Project1
release
my.jar
build.gradle
The ProjectMain need jar Project1/release/my.jar
. In build.gradle
for Project1
I release logic for creatting jar. It is necessary that when ProjectMain
assebly used dependency of my.jar
.
How I can do it? (desirable with groovy code).
PS before I used ant, and write simple xml and it works
<target name="one"?
<path id="project.classpath">
<fileset dir="${Project1.release}">
<patternset includes="**/*.jar"/>
</fileset>
</path>
</target>
<target name="Two">
<javac srcdir="${src}" destdir="${out}" debug="on">
<classpath refid="project.classpath"/>
</javac>
</target>
"calling" a different build.gradle isn't the right way to go about this. You should look into gradle multi-project setup If you setup as a multi-project, gradle manages building upstream dependency projects first.
If you want to run external build.gradle, you can import another build.gradle into your build.gradle by using "apply from".
Put this into "ProjectMain/Build.gradle". (I think it is local file)
apply from:"file://[PJ_DIR]/Project1/build.gradle";
And this is like Project1's build.gradle.
apply plugin: 'java'
version = 1.0
task makejar(type: Jar) {
from sourceSets.main.output
baseName = "my"
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.