简体   繁体   中英

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. Other files need not to be build in that jar. Jar should have the class1 and its dependencies alone.

How can I do it? Please help me.

Thanks in advance.

You can try creating java library project using below command

gradle init --type java-library

This will create project structure for you to begin with.

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.

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