intellij-idea - 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但我看不到与我的问题的相关性。
谢谢你的帮助。
解决方案
推荐阅读
- fortify - 强化扫描:ASP.NET MVC 不良做法:具有必需属性的可选子模型 - 但子模型中的必需属性可以为空
- python - 将 XLSX 转换为 PDF
- reactjs - 为什么这没有在反应时呈现
- r - How to change a group of data values to 0 given the condition
- r - 防止在更改数据时刷新 SelectInput
- java - LiveData 观察者没有通过从 DialogFragment 插入数据来获取数据
- android - 如何获取 Flutter 中导航/状态栏的当前颜色?
- python - 如何在不等待 Tkinter 菜单命令功能完成的情况下更新 Tkinter 标签文本?
- node.js - 即使路径正确,Docker-compose 在安装时也会引发卷路径错误
- java - 带有 espresso 驱动程序的 Appium - 无法构建 Espresso 服务器错误