如何将构建部分从maven1转换为maven2?

时间:2012-04-24 08:13:15

标签: maven maven-2 pom.xml

如何正确复制maven2的行为?

<build>
    <sourceDirectory>src/java</sourceDirectory>
    <resources>
        <resource>
            <directory>src/etc/</directory>
            <include>atlassian-plugin.xml</include>
            <include>**/*.vm</include>
        </resource>
    </resources>
    <unitTestSourceDirectory>test/java</unitTestSourceDirectory>
    <unitTest>
        <includes>
            <include>**/*Test.java</include>
            <include>**/Test*.java</include>
        </includes>
        <excludes>
            <exclude>**/Abstract*.java</exclude>
        </excludes>
        <resources>
            <resource>
                <directory>test/etc</directory>
            </resource>
        </resources>
    </unitTest>
</build>

1 个答案:

答案 0 :(得分:2)

这将是这样的:

<build>
  <sourceDirectory>src/java</sourceDirectory>
  <resources>
    <resource>
      <directory>src/etc/</directory>
      <includes>
        <include>atlassian-plugin.xml</include>
        <include>**/*.vm</include>
      </includes>
    </resource>
  </resources>
  <testSourceDirectory>test/java</testSourceDirectory>
  <testResources>
    <testResource>
      <directory>test/etc</directory>
    </testResource>
  </testResources>
  <pluginManagement>
    <plugins>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <includes>
            <include>**/*Test.java</include>
            <include>**/Test*.java</include>
          </includes>
          <excludes>
            <exclude>**/Abstract*.java</exclude>
          </excludes>
        </configuration>
      </plugin>
    </plugins>
  </pluginManagement>
</build>