摇篮不生成罐子 [英] Gradle not generate jar
问题描述
我的gradle有问题. 我的项目它包含几个模块(osgi). 当我运行命令时: ./gradlew清洁组装 Gradle为每个模块生成jar文件,但我想使用以下命令: ./gradlew clean compileJava 为了加快工作速度,但是使用此命令gradle不会为两个模块生成jar文件. 可能是什么原因?
I have a problem with gradle. My project It consists of several modules (osgi). When I run command: ./gradlew clean assemble Gradle generate the jar file for each module, but I want use the command: ./gradlew clean compileJava to speed up the work, but with this command gradle don't generate the jar file for two module. what could be the reason?
推荐答案
You can see in the diagram in figure 1 from this documentation the dependencies between Java plugin tasks:
- 看到
assemble
任务取决于jar
任务:这就是为什么当您执行gradlew assemble
Gradle会为每个模块构建jar的原因 - 看到
compileJava
任务没有依赖性:此任务将简单地将Java源文件编译为.class
文件.这就是为什么仅执行gradlew clean compileJava
不会产生jar的原因.
- see that
assemble
tasks dependes onjar
task: this is why when you executegradlew assemble
Gradle will build the jar for each module - see that
compileJava
task has no dependency: this task will simply compile your java source file into.class
files. That's why no jar will be produced if you execute onlygradlew clean compileJava
.
奇怪的是,您说您在调用gradle compileJave
时得到了罐子:摇篮通常不应该生产这些罐子.
What is strange is that you say you get the jar procuded when invoking gradle compileJave
: Gradle should normally not produce these jars.
这篇关于摇篮不生成罐子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!