Eclipse自动构建输出与Maven命令行构建输出交互

Chr*_*ach 9 eclipse m2eclipse maven-3 maven

由于两者都使用目标目录,因此Eclipse的构建输出有时会干扰在命令行运行的mvn构建的输出.

分离两个输出的最佳方法是什么?

Chr*_*ach 11

将以下内容插入pom.xml.Eclipse的"m2e.version"属性将激活以下配置文件,该配置文件会改变Eclipse构建的位置

<profiles>
  <profile>
    <id>IDE</id>
    <activation>
      <property>
        <name>m2e.version</name>
      </property>
    </activation>
    <build>
      <!-- Put the IDE's build output in a folder other than target, so that IDE builds don't interact with Maven builds -->
      <directory>target-ide</directory>
    </build>
  </profile>
</profiles>
Run Code Online (Sandbox Code Playgroud)