Java gradle 6.0实现是否在类路径中包含项目类
我包括一个在Gradle 6.0中使用的项目:Java gradle 6.0实现是否在类路径中包含项目类,java,gradle,Java,Gradle,我包括一个在Gradle 6.0中使用的项目: implementation project(":soa-wallet:soa-wallet-api") 它编译成功,但当我运行应用程序时,它抛出错误: at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE] at com.sportswin.so
implementation project(":soa-wallet:soa-wallet-api")
它编译成功,但当我运行应用程序时,它抛出错误:
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at com.sportswin.soa.wallet.AppStarter.main(AppStarter.java:32) [main/:na]
Caused by: java.io.FileNotFoundException: class path resource [com/sportswin/soa/wallet/controller/IFeignClientWalletConsumeRecordController.class] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:180) ~[spring-core-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:51) ~[spring-core-5.1.5.RELEASE.jar:5.1.5.RELEASE]
位于org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
在com.sportswin.soa.wallet.AppStarter.main(AppStarter.java:32)[main/:na]
原因:java.io.FileNotFoundException:无法打开类路径资源[com/sportswin/soa/wallet/controller/ifeignClientWalletConsumerRecordController.class],因为它不存在
在org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:180)~[spring-core-5.1.5.RELEASE.jar:5.1.5.RELEASE]
在org.springframework.core.type.classreading.SimpleMetadataReader.(SimpleMetadataReader.java:51)~[spring-core-5.1.5.RELEASE.jar:5.1.5.RELEASE]
如果EIGNClientWalletConsumerRecordController
在引用项目中,为什么在运行时找不到dit类?我应该怎么解决这个问题?我终于找到了应用程序自动的插件包mysoa wallet api
到一个应用程序,而不是库,所以使用这个lib找不到类,解决问题,您可以使用此代码启用lib包:
jar{
// enable package thin Jar
enabled = true
}
这应该可以解决这个问题。如果通过反射进行实例化,则不会出现编译问题。