![](/img/trans.png)
[英]Intellij IDEA + JBoss doesn't update LESS files on runtime compilation
[英]Maven: excluding files from compilation doesn't work in IntelliJ IDEA
我想暂时从编译中排除某个目录,所以我配置了 maven-compiler-plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/foo/**/*.java</exclude>
</excludes>
</configuration>
</plugin>
从命令行和 Eclipse 一切正常,但在 IntelliJ IDEA 中,我在排除目录中出现编译错误。 知道什么可能导致问题吗?
这是一个未解决的问题,请关注更新。
我在迁移 maven 项目时遇到了同样的问题。 我通过选择以下选项使其工作:
文件 > 设置 > 构建、执行、部署 > 构建工具 > Maven > Runner
选中“将 IDE 构建/运行操作委托给 Maven”选项。
此处提供说明: IntelliJ 文档
我在尝试解决 IntelliJ IDEA 中的 Java 9 模块信息编译时发现了这个问题。
我希望我的库使用 Java 8 编译,但同时我希望它具有模块信息(只能使用 JDK 9+ 编译)。 Maven 建议的此问题的解决方案:从使用 JDK 8 的编译中排除 module-info,如果使用 JDK 9,则包括。 它适用于命令行,但 IDEA 无法编译此类项目。 可以通过将模块信息添加到排除来调整 IDEA 编译配置,但我想要更清晰的解决方案。
可以通过添加带有源目录扩展列表的 Maven Profile 来欺骗 IDEA:
<profile>
<!-- This profile enables two pass compilation:
1. Compile all sources with Java 9 target version (including module-info.java)
2. Recompile all sources with Java 8 target version, but module-info.java
After this all classes will have Java 8 bytecode (version 52), while
module-info.class will have Java 9 bytecode (version 53) -->
<id>J9-module</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<release>8</release>
</configuration>
<executions>
<execution>
<id>default-compile</id>
<goals>
<goal>compile</goal>
</goals>
<phase>compile</phase>
<configuration>
<compileSourceRoots>
<sourceRoot>${project.basedir}/src/main/java</sourceRoot>
<sourceRoot>${project.basedir}/src/main/java9</sourceRoot>
</compileSourceRoots>
<release>9</release>
</configuration>
</execution>
<execution>
<id>java-8-recompile</id>
<goals>
<goal>compile</goal>
</goals>
<phase>compile</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
使用上面显示的配置文件,IDEA 本身将只编译标准src/main/java
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.