【问题标题】:Is it possible to create 1 Spring component index for a multi-module project?是否可以为多模块项目创建 1 个 Spring 组件索引?
【发布时间】:2019-11-06 04:13:27
【问题描述】:

我们有一个多模块 spring 项目,我们想为整个项目创建一个组件索引。

将“spring-context-indexer”添加到 POM(s) 时,会为项目中的每个模块创建一个单独的索引,但是我们正在寻找的是一个用于多模块项目的所有模块的组件索引.

有谁知道是否可以生成这样的索引?

【问题讨论】:

  • 你找到答案了吗?

标签: java spring maven spring-mvc


【解决方案1】:

把它放在主 pom 上,或者放在每个模块 pom 上。每个包都有自己的索引。

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${mavenCompilerVer}</version>
            <configuration>
                <source>11</source>
                <target>11</target>
                <annotationProcessorPaths>
                    <path>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring-context-indexer</artifactId>
                        <version>${springContextIndexerVer}</version>
                    </path>
                    <path>
                        <groupId>org.projectlombok</groupId>
                        <artifactId>lombok</artifactId>
                        <version>${lombokVer}</version>
                    </path>
                </annotationProcessorPaths>
            </configuration>
        </plugin>

【讨论】:

    猜你喜欢
    • 2018-08-08
    • 2014-12-15
    • 2017-09-20
    • 1970-01-01
    • 2018-04-25
    • 1970-01-01
    • 2019-08-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多