gpt4 book ai didi

eclipse - 在Intellij IDEA中自动激活maven配置文件

转载 作者:行者123 更新时间:2023-12-02 18:25:41 25 4
gpt4 key购买 nike

有没有办法在 IntelliJ IDEA 中打开项目时自动激活 Maven 配置文件?

对于 eclipse,这可以通过使用属性 m2e.version 进行激活来完成,我认为 IDEA 可能有类似的东西。

<profiles>
<profile>
<id>m2e</id>
<activation>
<property>
<name>m2e.version</name>
</property>
</activation>
<build>
<directory>${project.basedir}/eclipse-target</directory>
</build>
</profile>
</profiles>

我基本上想要的是为 IDEA 有一个单独的构建目录。这对于在命令行上运行 mvn 命令非常有用,而不会干扰 IDE。

最佳答案

IntellJ 在运行 Maven 运行配置时设置 idea.version 属性。在导入基于 Maven 的项目时,它还会在检测默认配置文件时设置此属性。

    <profile>
<id>activeInIdea</id>
<activation>
<property>
<name>idea.version</name>
</property>
</activation>
<build>
<directory>${project.basedir}/eclipse-target</directory>
</build>
</profile>

在 IntelliJ 中打开项目后,配置文件(在上面的示例中称为 activeInIdea)已被预先选择。

关于eclipse - 在Intellij IDEA中自动激活maven配置文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25550353/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com