1. build.gradle
plugins { id 'java' id 'application' } group 'org.example' version '1.0-SNAPSHOT' sourceCompatibility = 11 targetCompatibility = 11 mainClassName = 'com.bingco.Setup' repositories { mavenLocal() mavenCentral() } dependencies { testCompile group: 'junit', name: 'junit', version: '4.12' implementation 'com.alibaba:fastjson:1.2.70' } compileJava { options.compilerArgs += ['--module-path', classpath.asPath] }
2. module-info.java
/** * <h3>模块化配置 * <p> * create: 2020/11/23 <br/> * email: bingco.zn@gmail.com <br/> * * @author zhan_bingcong * @since jdk8+ */ module test.main { requires fastjson; exports com.bingco; }