微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

IntelliJ Idea 忽略 Maven 默认配置文件

如何解决IntelliJ Idea 忽略 Maven 默认配置文件

我试图说服我的层次结构从 Eclipse 切换到 IntelliJ,所以我选择用社区版本打开一个 Maven 项目。 在这个 maven 项目中,有一个文件应该被排除在编译之外,除非激活特定的配置文件

这在 Eclipse 上运行良好,但 IntelliJ Idea 在“付费”(我下载并可以尝试一段时间)或社区版本(最新版本,2020.3.2)上对此感到窒息

这个 pom.xml 摘录显示了两个配置文件,其中一个认处于活动状态。这个配置文件从编译中排除了一个文件,但 IntelliJ 没有注意到它并尝试编译它,即使所需的依赖项尚未加载(最后与 pom 配置文件一致?)

<profiles>
    <profile>
        <id>use-eobjects</id>
        <properties>
            <sas.impl>com.xxx.dataLib.sasfiles.SASEObjectsImpl</sas.impl>
        </properties>
        <build>
            <plugins>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <excludes>
                            <exclude>**/SASEpamImpl.java</exclude>
                        </excludes>
                    </configuration>
                </plugin>
            </plugins>
        </build>
        <dependencies>
            <dependency>
                <groupId>org.eobjects.metamodel-extras</groupId>
                <artifactId>metamodel-extras-sas</artifactId>
                <version>4.3.2</version>
            </dependency>
        </dependencies>
    </profile>
    <profile>
        <id>use-epam</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <properties>
            <sas.impl>com.xxx.dataLib.sasfiles.SASEpamImpl</sas.impl>
        </properties>
        <build>
            <plugins>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <excludes>
                            <exclude>**/SASEOjbectsImpl.java</exclude>
                        </excludes>
                    </configuration>
                </plugin>
            </plugins>
        </build>
        <dependencies>
            <dependency>
                <groupId>com.epam</groupId>
                <artifactId>parso</artifactId>
                <version>2.0</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
        </dependencies>
    </profile>
</profiles>

在这里 https://youtrack.jetbrains.com/issue/IDEA-97932 找到了一个旧的错误跟踪,但我没有看到与我的问题的相关性。

感谢您的帮助。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。