我从Java9开始就读过模块化。我知道我必须创建一个模块信息和信息哪个包是公开的和必需的。我可以看到我的类路径上确实有Java11。但是我得到了这个话题上提到的错误。更准确地说,在构建时,我得到了这个错误日志
INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ zuul ---
[WARNING] Can't extract module name from xpp3_min-1.1.4c.jar: Provider class org.xmlpull.mxp1.MXParser,org.xmlpull.mxp1_serializer.MXSerializer not in module
[WARNING] ********************************************************************************************************************
[WARNING] * Required filename-based automodules detected. Please don't publish this project to a public artifact repository! *
[WARNING] ********************************************************************************************************************
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to C:\_d\WSs\soteste\zuul\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/_d/WSs/soteste/zuul/src/main/java/module-info.java:[24,18] module not found: common
[INFO] 1 error
我缺少一些额外的设置,以便使来自公共项目的类对其他项目可见?
PS1:我跟着
Import XXX cannot be resolved for Java SE standard classes
并设置为替代JRE。
面向企业Java开发人员的eclipseide。
版本:2018-12(4.10.0)
操作系统:Windows 10、v.10.0、x86\u 64/win32
Java版本:11.0.2
在我的zul项目中:
import com.test.common.security.JwtConfig;
@EnableWebSecurity
public class SecurityTokenConfig extends WebSecurityConfigurerAdapter {
@Autowired
private JwtConfig jwtConfig;
...
模块-信息.java
module zuul {
...
requires common;
}
在我共同的项目中
@Getter
@ToString
public class JwtConfig {
...
module common {
exports com.test.common.security;
exports com.test.common;
...
}