什么是Maven POM.xml中的workingDirectory?

时间:2018-04-03 13:16:22

标签: maven maven-3 pom.xml

想要了解Maven POM.xml中使用标记的内容和原因。标签有什么意义?

示例:

Flamegraph

1 个答案:

答案 0 :(得分:1)

默认情况下,Maven POM中没有workingDirectory元素,有关您可以在POM中使用的元素的详细信息,请参阅Maven POM reference

但是,某些插件配置中可能存在workingDirectory,例如Maven Exec Plugin上的exec:exec目标,例如:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.6.0</version>
    <executions>
      <execution>
        <goals>
          <goal>exec</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
      <executable>java</executable>
      <workingDirectory>target/</workingDirectory>
      <arguments>
        <argument>-classpath</argument>
        <classpath>
          <dependency>commons-io:commons-io</dependency>
          <dependency>commons-lang:commons-lang</dependency>
        </classpath>
        <argument>com.example.Main</argument>
      </arguments>
    </configuration>
  </plugin>

将从java目录执行target。但是,在您的示例中在编译器插件中添加workingDirectory不会做任何事情 - 没有这样的配置。