简体   繁体   English

如何使用gradle在同一文件夹中的多个文件中编译单个java文件?

[英]How to compile a single java file among multiple files in the same folder with gradle?

I am new to gradle. 我是新来的。 I have a project. 我有一个项目。 Within that lot of main classes along with its dependent classes are present under the same folder/package. 在同一文件夹/程序包中存在大量的主类及其从属类。

EG: 例如:

default package
     ---class1.java
     ---class2.java
     ---class3.java
     ---class1dependencyclass.java

Within that build doing gradle build the jar file created only with class1 and its class1dependencyclass. 在这一建设做gradle build只有1类和class1dependencyclass创建的jar文件。 Other files need not to be build in that jar. 其他文件无需在该jar中构建。 Jar should have the class1 and its dependencies alone. Jar应该仅具有class1及其依赖项。

How can I do it? 我该怎么做? Please help me. 请帮我。

Thanks in advance. 提前致谢。

You can try creating java library project using below command 您可以尝试使用以下命令创建Java库项目

gradle init --type java-library

This will create project structure for you to begin with. 这将为您创建项目结构。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM