没有模块化的Java 11:当包作为maven依赖项添加时,它不存在

没有模块化的Java 11:当包作为maven依赖项添加时,它不存在,java,eclipse,maven,spring-boot,java-11,Java,Eclipse,Maven,Spring Boot,Java 11,我有三个非常简单的应用程序。一个是常见的,我将集中安全配置,另一个是ZUUL功能,第三个是EUREKA服务器。两者都是SpringBoot和Java11。尽管我使用的是Java11,但我并没有重温模块化(据我所知,在SpringBoot中使用模块化特性是没有意义的) 当我在Eclipse中运行这三个组件时,我可以成功地按顺序运行服务器common和zuul。当我尝试maven构建时,我得到了主题中提到的错误 直接的解释是“zuul类路径中没有公共路径”。好吧,据我所知,我在zuul类路径中有共同

我有三个非常简单的应用程序。一个是常见的,我将集中安全配置,另一个是ZUUL功能,第三个是EUREKA服务器。两者都是SpringBoot和Java11。尽管我使用的是Java11,但我并没有重温模块化(据我所知,在SpringBoot中使用模块化特性是没有意义的)

当我在Eclipse中运行这三个组件时,我可以成功地按顺序运行服务器common和zuul。当我尝试maven构建时,我得到了主题中提到的错误

直接的解释是“zuul类路径中没有公共路径”。好吧,据我所知,我在zuul类路径中有共同点。我想知道是否有额外的配置,因为我使用的是Java11,而不是modularaty

我说我使用的是Java11,但不是模块化,我的意思是,我有Java11,但在这三个项目中我根本没有module-info.Java

签入.m2文件夹并解压common.jar,我确实看到了这个类

Zuul项目pom:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.3.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.test</groupId>
    <artifactId>zuul</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>zuul</name>
    <description>Zuul project</description>

    <properties>
        <java.version>11</java.version>
        <spring-cloud.version>Greenwich.SR1</spring-cloud.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-zuul</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <!-- https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt -->
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt</artifactId>
            <version>0.9.1</version>
        </dependency>

        <dependency>
            <groupId>com.test</groupId>
            <artifactId>common</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

4.0.0
org.springframework.boot

mvn清理安装期间出错:

[INFO] Scanning for projects...
[INFO] 
[INFO] ---------------------------< com.test:zuul >----------------------------
[INFO] Building zuul 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ zuul ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ zuul ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to C:\_d\WSs\soteste\zuul\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /C:/_d/WSs/soteste/zuul/src/main/java/com/test/zuul/security/SecurityTokenConfig.java:[14,32] package com.test.common.security does not exist
[ERROR] /C:/_d/WSs/soteste/zuul/src/main/java/com/test/zuul/security/SecurityTokenConfig.java:[21,17] cannot find symbol
  symbol:   class JwtConfig
  location: class com.test.zuul.security.SecurityTokenConfig
[ERROR] /C:/_d/WSs/soteste/zuul/src/main/java/com/test/zuul/security/SecurityTokenConfig.java:[46,16] cannot find symbol
  symbol:   class JwtConfig
  location: class com.test.zuul.security.SecurityTokenConfig
[ERROR] /C:/_d/WSs/soteste/zuul/src/main/java/com/test/zuul/security/SecurityTokenConfig.java:[47,23] cannot find symbol
  symbol:   class JwtConfig
  location: class com.test.zuul.security.SecurityTokenConfig
[INFO] 4 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.778 s
[INFO] Finished at: 2019-03-21T14:23:23-03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project zuul: Compilation failure: Compilation failure: 
[ERROR] /C:/_d/WSs/soteste/zuul/src/main/java/com/test/zuul/security/SecurityTokenConfig.java:[14,32] package com.test.common.security does not exist
[ERROR] /C:/_d/WSs/soteste/zuul/src/main/java/com/test/zuul/security/SecurityTokenConfig.java:[21,17] cannot find symbol
[ERROR]   symbol:   class JwtConfig
[ERROR]   location: class com.test.zuul.security.SecurityTokenConfig
[ERROR] /C:/_d/WSs/soteste/zuul/src/main/java/com/test/zuul/security/SecurityTokenConfig.java:[46,16] cannot find symbol
[ERROR]   symbol:   class JwtConfig
[ERROR]   location: class com.test.zuul.security.SecurityTokenConfig
[ERROR] /C:/_d/WSs/soteste/zuul/src/main/java/com/test/zuul/security/SecurityTokenConfig.java:[47,23] cannot find symbol
[ERROR]   symbol:   class JwtConfig
[ERROR]   location: class com.test.zuul.security.SecurityTokenConfig
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[INFO]正在扫描项目。。。
[信息]
[信息]----------------------------------------------------------------
[信息]正在构建zuul 0.0.1-SNAPSHOT
[信息]------------------------------------[jar]---------------------------------
[信息]
[信息]---maven资源插件:3.1.0:resources(默认资源)@zuul---
[信息]使用“UTF-8”编码复制筛选的资源。
[信息]正在复制1个资源
[信息]正在复制0资源
[信息]
[信息]---maven编译器插件:3.8.0:compile(默认编译)@zuul---
[信息]检测到更改-重新编译模块!
[信息]正在将2个源文件编译为C:\\U d\WSs\soteste\zuul\target\classes
[信息]-------------------------------------------------------------
[错误]编译错误:
[信息]-------------------------------------------------------------
[错误]/C://\u d/WSs/soteste/zuul/src/main/java/com/test/zuul/security/SecurityTokenConfig.java:[14,32]包com.test.common.security不存在
[错误]/C://\u d/WSs/soteste/zuul/src/main/java/com/test/zuul/security/SecurityTokenConfig.java:[21,17]找不到符号
符号:类JwtConfig
位置:class com.test.zuul.security.SecurityTokenConfig
[错误]/C://\u d/WSs/soteste/zuul/src/main/java/com/test/zuul/security/SecurityTokenConfig.java:[46,16]找不到符号
符号:类JwtConfig
位置:class com.test.zuul.security.SecurityTokenConfig
[错误]/C://\u d/WSs/soteste/zuul/src/main/java/com/test/zuul/security/SecurityTokenConfig.java:[47,23]找不到符号
符号:类JwtConfig
位置:class com.test.zuul.security.SecurityTokenConfig
[信息]4个错误
[信息]-------------------------------------------------------------
[信息]------------------------------------------------------------------------
[信息]生成失败
[信息]------------------------------------------------------------------------
[信息]总时间:4.778秒
[信息]完成时间:2019-03-21T14:23:23-03:00
[信息]------------------------------------------------------------------------
[错误]未能在项目zuul上执行目标org.apache.maven.plugins:maven编译器plugin:3.8.0:compile(默认编译):编译失败:编译失败:
[错误]/C://\u d/WSs/soteste/zuul/src/main/java/com/test/zuul/security/SecurityTokenConfig.java:[14,32]包com.test.common.security不存在
[错误]/C://\u d/WSs/soteste/zuul/src/main/java/com/test/zuul/security/SecurityTokenConfig.java:[21,17]找不到符号
[错误]符号:类JwtConfig
[错误]位置:class com.test.zuul.security.SecurityTokenConfig
[错误]/C://\u d/WSs/soteste/zuul/src/main/java/com/test/zuul/security/SecurityTokenConfig.java:[46,16]找不到符号
[错误]符号:类JwtConfig
[错误]位置:class com.test.zuul.security.SecurityTokenConfig
[错误]/C://\u d/WSs/soteste/zuul/src/main/java/com/test/zuul/security/SecurityTokenConfig.java:[47,23]找不到符号
[错误]符号:类JwtConfig
[错误]位置:class com.test.zuul.security.SecurityTokenConfig
[错误]->[帮助1]
[错误]
[错误]要查看错误的完整堆栈跟踪,请使用-e开关重新运行Maven。
[错误]使用-X开关重新运行Maven以启用完整调试日志记录。
[错误]
[错误]有关错误和可能的解决方案的更多信息,请阅读以下文章:
[错误][帮助1]http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
这个班的学生在罐子里

***编辑

普通聚甲醛

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.3.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.test</groupId>
    <artifactId>common</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>common</name>
    <description>Zuul project</description>

    <properties>
        <java.version>11</java.version>
        <spring-cloud.version>Greenwich.SR1</spring-cloud.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

4.0.0
org.springframework.boot
spring启动程序父级
2.1.3.1发布
com.test
常见的
0.0.1-快照
常见的
祖尔项目
11
格林威治
org.springframework.cloud
spring cloud starter netflix eureka服务器
org.springframework.boot
弹簧靴开发工具
运行时
org.projectlombok
龙目
真的
org.springframework.boot
弹簧起动试验
测试
org.springframework.cloud
spring云依赖关系
${spring cloud.version}
聚甲醛
进口
org.springframework.boot
springbootmaven插件

Eclipse能够将当前开放工作区的Eclipse项目作为Maven依赖项解析到其他项目中,这是Eclipse的一个特长

如果您在命令行上或从Eclipse中执行Maven,那么您将离开Eclipse的范围,使用普通Maven。Pl
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <classifier>exec</classifier>
            </configuration>
        </plugin>
    </plugins>
</build>